Skip to content

Pretty printing: Strict record fields are not parenthesized properly

When I type in GHCi:

λ> data Foo = Foo { x :: !(Maybe Int) }
λ> :i Foo
data Foo = Foo {x :: !Maybe Int}        -- Defined at <interactive>:71:1

But this is not legal Haskell syntax:

λ> data Foo = Foo {x :: !Maybe Int}

<interactive>:73:22: error:
    • Unexpected strictness annotation: !Maybe
    • In the type ‘!Maybe Int’
      In the definition of data constructor ‘Foo’
      In the data declaration for ‘Foo’

I think it should be pretty printed with parens:

λ> :i Foo
data Foo = Foo {x :: !(Maybe Int)}        -- Defined at <interactive>:71:1
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information