Skip to content

GHCi >= 9.2.1 prints type signatures containing type families in an ugly way

Consider the following:

{-# LANGUAGE DataKinds, KindSignatures, TypeFamilies, TypeOperators #-}

import Data.Kind

class A (m :: Type -> Type)
class B (m :: Type -> Type)

type family F cs (m :: Type -> Type) :: Constraint where
  F '[]      m = ()
  F (c : cs) m = (c m, F cs m)

test :: F [Monad, A, B] m => m ()
test = pure ()

The type signature of test is pretty-printed in GHCi 9.0.2 and lower:

$ ghci-9.0.2 
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/unknown/.ghci
>>> :l test
[1 of 1] Compiling Main             ( test.hs, interpreted )
Ok, one module loaded.
>>> :t test
test :: (Monad m, A m, B m) => m ()

but this is what happens in 9.2.1 and HEAD:

$ ghci-9.2.1 
GHCi, version 9.2.1: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/unknown/.ghci
>>> :l test.hs 
[1 of 1] Compiling Main             ( test.hs, interpreted )
Ok, one module loaded.
>>> :t test
test :: (Monad m, (A m, (B m, () :: Constraint))) => m ()

Looks much worse and I'd consider that a regression.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information