TypeRep Show instance doesn't add parens around type operators
The following code
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE TypeOperators #-}
import Data.Typeable
data a :*: b = Pair a b
main = print (typeOf (Pair 'a' 'b'))
prints
:*: Char Char
which is not valid Haskell. I belive it should print
(:*:) Char Char
In my particular case I am using Hint to interpret a type involving type operators. Hint uses showed TypeRep as a type annotation:
let type_str = show $ Data.Typeable.typeOf wit
...
let expr_typesig = concat [parens e, " :: ", type_str]
What results in a parse error.
I can write a patch if someone confirms that's the desired behavior and doesn't break anything.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.1-rc3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ekmett, hvr |
| Operating system | |
| Architecture |