Skip to content

:info incorrectly parenthesizes GADT return types in 8.8.1

Load this code into GHCi 8.8.1:

{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
module Bug where

import Data.Kind

data T :: Type -> Type where
  MkT :: T (Maybe Bool)

And then run :info T. You'll get some unusual results:

$ /opt/ghc/8.8.1/bin/ghci Bug.hs
GHCi, version 8.8.1: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Ok, one module loaded.
λ> :info T
type role T nominal
data T a where
  MkT :: T Maybe Bool
        -- Defined at Bug.hs:7:1

Notice how the return type is T Maybe Bool, which is wrong. Compare this to GHCi 8.6.5:

$ /opt/ghc/8.6.5/bin/ghci Bug.hs
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug              ( Bug.hs, interpreted )
Ok, one module loaded.
λ> :info T
type role T nominal
data T a where
  MkT :: T (Maybe Bool)
        -- Defined at Bug.hs:7:1

This was a regression introduced by someone who shall remain unnamed in 9d9e3557. Coincidentally, someone who shall remain unnamed will be preparing a fix shortly.

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