Pretty-printing of equality `~` without parentheses
Based off on Data.Constraint.Deferrable
{-# Language RankNTypes, ConstraintKinds #-}
import Data.Typeable
class Deferrable p where
deferEither :: proxy p -> (p => r) -> Either String r
instance (Typeable a, Typeable b) => Deferrable (a ~ b) where
deferEither = undefined
PolyKinds
aren't enabled so deferEither @(_ ~ _)
is not enough to select the Deferrable (a ~ b)
instance, but it is displayed without parentheses
$ ghci -XTypeApplications -ignore-dot-ghci tyiS.hs
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( tyiS.hs, interpreted )
Ok, modules loaded: Main.
*Main> :t deferEither @(_ ~ _)
deferEither @(_ ~ _)
:: Deferrable t ~ t1 =>
proxy t ~ t1 -> (t ~ t1 => r) -> Either String r
Instead of a preferable
deferEither @(_ ~ _) :: Deferrable (t ~ t1) => proxy (t ~ t1) -> (t ~ t1 => r) -> Either String r
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |