[Haskell-cafe] Template Haskell, information about data constructor types

Ian Lynagh igloo at earth.li
Tue Jun 5 12:24:10 EDT 2007


On Mon, Jun 04, 2007 at 10:45:30AM +0100, Neil Mitchell wrote:
> 
> On 6/4/07, Simon Peyton-Jones <simonpj at microsoft.com> wrote:
> 
> > Perhaps you mean that reify doesn't work on type constructors?  (E.g. 
> > reify ''Maybe).
> >It should -- if you think it doesn't can you concoct a test case and 
> >submit it?
> 
> I'm not sure if I'm doing something wrong, as I haven't managed to get
> it working for any type constructors. A test case:
> 
> ghci -fth
> Prelude> :m Language.Haskell.TH
> Language.Haskell.TH> $( reify (mkName "Maybe") >>= error . show )

This works:
    $( reify ''Maybe >>= runIO . print >> [| 'c' |] )

(modulo printing the result 4 times due to
http://hackage.haskell.org/trac/ghc/ticket/1201)

I don't think your example is expected to work.


Thanks
Ian



More information about the Haskell-Cafe mailing list