[Haskell-cafe] Help me TH code.
sergueyz at gmail.com
Wed Oct 27 02:27:53 EDT 2010
2010/10/27 Andy Stewart <lazycat.manatee at gmail.com>:
> Hi all,
> I want use TH write some function like below:
> data DataType = StringT
> | IntT
> | CharT
> parse :: [(String,DataType)] -> (TypeA, TypeB, ... TypeN)
> parse [("string", StringT), ("001", IntT), ("c", CharT)]
> will return:
> ("string", 001, 'c')
> So how to use TH write 'parse' function?
I think that you should use TH properly, without compiler and logical errors.
What actually do you want?
I think that parse should have type (parse :: [(String, DataType)] -> Q Exp).
I think that OverloadedStrings extension should serve you as well.
More information about the Haskell-Cafe