[Haskell-cafe] understanding generics

José Pedro Magalhães jpm at cs.uu.nl
Thu Apr 16 08:12:57 EDT 2009

Hello Anatoly,

On Sat, Apr 11, 2009 at 20:44, Anatoly Yakovenko <aeyakovenko at gmail.com>wrote:

> i am trying to understand how data.data works.  How would i traverse
> the subterms of one type and build another type out of them.
> something like this:
> > gmapQ (\a -> Right a) (Just "hello")

I am not sure I understand what you're trying to do here. However, in
general, 'gmapQ' is used in combination with 'mkQ' or 'extQ'. Those are not
in Data.Data: you can import Data.Generics to get everything syb-related.


> <interactive>:1:0:
>    Inferred type is less polymorphic than expected
>      Quantified type variable `d' escapes
>    In the first argument of `gmapQ', namely `(\ a -> Right a)'
>    In the expression: gmapQ (\ a -> Right a) (Just "hello")
>    In the definition of `it':
>        it = gmapQ (\ a -> Right a) (Just "hello")
> Thanks,
> Anatoly
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090416/d7bae0ad/attachment.htm

More information about the Haskell-Cafe mailing list