[Haskell-cafe] TH not compiling when writing the code directly does

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Thu Mar 12 11:05:44 UTC 2015

Dear Michael,

Michael Jones wrote:
> I’m stuck getting a TH expansion to compile. When I take the generated
> code and compile it directly, it is fine. But when expanding and
> compiling, it fails.
> The problem seems related to instanceD, where I provide the type as:
>  (appT (appT (conT devName') (varT $ mkName "Word8")) (varT $ mkName "BV”))
>     Illegal type variable name: ‘BV’

Indeed BV is the name of a type *constructor*, not a type *variable*,
so you need to use `conT` instead of `varT`:

 (appT (appT (conT devName') (conT $ mkName "Word8")) (conT $ mkName "BV”))



More information about the Haskell-Cafe mailing list