[Template-haskell] Re: [Bug?] AST representation of type-synonyms with phantom parameters

Alfonso Acosta alfonso.acosta at gmail.com
Mon Oct 29 09:27:37 EDT 2007


It seems to be a general GHC-issue (due to the internal representation
of type-synonyms with phantom types)

For example:

*Phantom Language.Haskell.TH> let f = (\_-> 1) :: PhantomSyn a -> Int
*Phantom Language.Haskell.TH> f "a"

<interactive>:1:2:
    Couldn't match expected type `PhantomSyn GHC.Prim.Any'
           against inferred type `[Char]'
      Expected type: PhantomSyn GHC.Prim.Any
      Inferred type: [Char]
    In the first argument of `f', namely `"a"'
    In the expression: f "a"


Pay attention to the error, it says:

PhantomSyn GHC.Prim.Any

instead of

Expected type: PhantomSyn a

Again, should this be considered a bug?

I don't think the end-user should know anything about GHC.Prim.Any.
The error is a bit confusing.

However, I still think that independently of how does GHC represent
type synonyms with phantom parameters, TH should represent their type
variables as such, and not as "GHC.Prim.Any"


More information about the template-haskell mailing list