Pretty Printing: GHC doesn't parenthesise (() :: Constraint)
From Ryan's How to derive Generic for (some) GADTs using QuantifiedConstraints:
data ECC ctx f a where
ECC :: ctx => f a -> ECC ctx f a
When instantiating the Constraint
using -XTypeApplications
with the empty constraint, GHC doesn't add parentheses (it should look like ... -> ECC (() :: Constraint) [] ()
)
$ ~/code/qc-ghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-ghci
GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help
Prelude> :set -XGADTs -XConstraintKinds -XTypeApplications
Prelude> data ECC ctx f a where ECC :: ctx => f a -> ECC ctx f a
Prelude> :t ECC @[] @() @()
ECC @[] @() @() :: [()] -> ECC () :: Constraint [] ()
Doesn't seem to happen in other cases:
Prelude> :t ECC @[] @() @((), ())
ECC @[] @() @((), ())
:: [()] -> ECC (() :: Constraint, () :: Constraint) [] ()
Prelude> :t ECC @[] @() @(Eq Int)
ECC @[] @() @(Eq Int) :: [()] -> ECC (Eq Int) [] ()