[Haskell-cafe] Help me TH code.

Andy Stewart lazycat.manatee at gmail.com
Tue Oct 26 22:16:24 EDT 2010


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? 

Thanks!

  -- Andy



More information about the Haskell-Cafe mailing list