
27 Oct
2010
27 Oct
'10
6:27 a.m.
2010/10/27 Andy Stewart
Hi all,
I want use TH write some function like below:
data DataType = StringT | IntT | CharT
parse :: [(String,DataType)] -> (TypeA, TypeB, ... TypeN)
Example:
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.