[Haskell-cafe] TH not compiling when writing the code directly does
Michael Jones
mike at proclivis.com
Thu Mar 12 13:15:09 UTC 2015
Bertram,
Oh I see. The items passed to the devName’ constructor must be constructors too.
I guess I did not think of that way. I thought of them as filling holes in constructor, thus values.
Too much OO in my past :-(
I’m slowly rebuilding those old neurons into something better.
Mike
On Mar 12, 2015, at 5:05 AM, Bertram Felgenhauer <bertram.felgenhauer at googlemail.com> wrote:
> 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”))
>
> HTH,
>
> Bertram
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list