Skip to content

GHCi 8.8+ parenthesizes GADT fields incorrectly with :info

Load the following code into GHCi using 8.8 or later:

{-# LANGUAGE GADTs #-}
module Bug where

data T where
  MkT :: (Int -> Int) -> T

And then try :info T:

λ> :info T
data T where
  MkT :: Int -> Int -> T
        -- Defined at Bug.hs:4:1

Eek! Those parentheses around Int -> Int are required, but aren't showing up here.

This is my fault, as I accidentally introduced this regression in commit 9d9e3557. When pretty-printing fields in a GADT type signature, I should have been using funPrec, not topPrec, since the fields are interspersed with arrows. Unfortunately, no regression tests existed to catch my mistake.

Patch incoming.

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