Skip to content

Incorrect pretty-printing of nullary constraint tuples in function types

Load this code into GHCi:

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

import Data.Kind

f :: (() :: Constraint) => String
f = "hello world"

And then check its type:

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.
λ> :type +v f
f :: () :: Constraint => String

Notice that the reported type is () :: Constraint => String, which lacks parentheses around () :: Constraint.

Patch incoming.

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