2010/10/27 Andy Stewart <lazycat.mana...@gmail.com>:
> 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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to