Is it possible to make a typeclass like Functor, that has a function
(say "f_map"), which would work for the infinite hierarchy of types:
([],[[]],[[[]]],...)?  Does that make sense?  This doesn't work...

>class Funct f where
>    f_map :: (a -> b) -> f a -> f b
>
>instance Funct [] where
>    f_map = map
>
>instance Funct a => Funct [a] where
>    f_map f = map (f_map f)
>
>main = print $ fmap (+1) [[[1,2,3]]]

...but maybe it gets the idea across?


Thanks,

Greg Buchholz

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to