On Oct 9, 2010, at 4:17 PM, André Batista Martins wrote:
If i want compose f and f1, i need to do a correct input to f1
from the output of f.
So i want one function to convert the output of "f" to input off
"f!".
In this case, we do f1 fst (snd (t,(t1,t2))) snd (snd (t,
(t1,t2)))
But i want do this automaticaly, for type of any two function. I
search for the "glue".
You have to write the glue. There is no way to do it automatically,
for all cases. If there was a way to derive the glue, they wouldn't
be separate cases.
Type classes are a common approach for writing glue functions. The
Functor and Monad type classes are good examples. (And there is a
nice algebra of functors in the small category of functors, too) I
wrote a weird little functorial type class yesterday, specifically to
handle newtypes as functors over their underlying datatype/category.
class Transform obj functor where
transform :: (obj -> obj) -> functor -> functor
instance Functor f => Transform obj (f obj) where transform = fmap
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe