[Haskell-cafe] How to use Template Haskell based on code that generated by another Template?
vogt.adam at gmail.com
Wed Jul 3 17:04:59 CEST 2013
On Wed, Jul 3, 2013 at 2:25 AM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Then I got
> Illegal variable name: `UserPassword'
> When splicing a TH declaration:
GHC seems to be trying to tell you that variables are lowercase in
haskell. Since you don't have code, I'm guessing your error is from
doing something like:
> wrong1 = print ($(dyn "Just") 5)
> wrong2 = print ($(varE 'Just) 5)
Which is a compile time error since you apparently can't pass a Name
which is capitalized to `VarE :: Name -> Exp'
Any of these options work. They use the `ConE :: Name -> Exp'
> opt1 = print ($(conE (mkName "Just")) 5)
> opt2 = print ($(conE 'Just) 5)
> opt3 = print ($( [| Just |]) 5 )
More information about the Haskell-Cafe