[Haskell-cafe] Functions of type foo :: f a -> g a

Gordon J. Uszkay uszkaygj at mcmaster.ca
Tue May 11 14:01:05 EDT 2010


I would like to build a class that includes a method to move data from one arbitrary functor to another, a natural transformation.   The structures might be more than just functors, but I can start with that.  I ran into some practical issues with resolving the type variables for my multiparameter type class, which I can resolve with functional dependencies.   I can also not isolate the natural transformation from my overall operation, muddling it with the element transformation.  I was wondering if anyone had any words of advice, example  or warning about this kind of function or method in general?

Class (Functor f, Functor g) => Foo f g a where
  foo :: f a -> g a
  bar :: (a->b) -> g a -> g b

Thanks,

Gordon J. Uszkay, McMaster University
uszkaygj at mcmaster.ca





More information about the Haskell-Cafe mailing list