Template Haskell - read function

Thomas L. Bevan thomas_bevan@toll.com.au
Wed, 2 Jul 2003 11:56:58 +0000


=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm struggling to write the following function in Template Haskell.

I have a phantom type,

>data HTMLPage a =3D HTMLPage FilePath

This type points to an HTML file, where 'a' refers to the return type of=20
the posted form.
So, mostly, I would expect types like
 HTMLPage (String, String, Date, Int)

Where this represented a form the returned someone's first name, last name,=
=20
dob and age.

So, I want a function that will take the returned name/value pairs and cast=
=20
them into the matching type.

eg.

>readForm :: Read a =3D> [(String,String)] -> HTMLPage a -> a

Can anyone give me any pointers or am I better off just abandoning this=20
approach?

Tom
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/AsiKYha8TWXIQwoRAvzuAKDPHD4oztAPLFShEWsLuclT7BaImwCfSB8e
9c2aTbTCSpVwabXVsht62DM=3D
=3DorX3
=2D----END PGP SIGNATURE-----