Skip to content

-ddump-simpl prints type applications with trailing whitespace

If you compile the following code with -ddump-simpl enabled:

{-# LANGUAGE TypeApplications #-}

true :: Bool
true = id @Bool True

You'll get something like this:

-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
true :: Bool
true = id @ Bool True

There's one key difference between the original code and the dumped Core: the latter puts an extra space between the @ and Bool, whereas the former does not. This used to be just a minor curiosity, but now that GHC Proposal 229 is implemented, id @ Bool True is no longer code that will even parse correctly.

Granted, Core is not exactly the same as source Haskell, but the @ syntax in Core has enough similarities to source Haskell's TypeApplications that it seems reasonable that we should try to make the two notations coincide. In light of this, I propose that we change -ddump-simpl's pretty-printer to display true like this:

-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
true :: Bool
true = id @Bool True

That is, do not put any space between the @ and Bool, just as TypeApplications now requires. Does this sound like a reasonable suggestion?

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