
11 Jul
2003
11 Jul
'03
5:34 a.m.
In article <20030710133324.GA2318@soi.city.ac.uk>,
Ross Paterson
As it happens, I would like yet another intermediate class:
class BiFunctor a where bimap :: (b' -> b) -> (c -> c') -> a b c -> a b' c'
This can be decomposed into: fmap :: (c -> c') -> a b c -> a b c' cofmap2 :: (b' -> b) -> a b c -> a b' c bimap :: (Cofunctor2 a,Functor (a b)) => (b' -> b) -> (c -> c') -> a b c -> a b' c' bimap bb cc = (cofmap2 bb) . (fmap cc) It would be nice to be able to write this: class (Cofunctor2 a,forall b. Functor (a b)) => BiFunctor a instance (Cofunctor2 a,forall b. Functor (a b)) => BiFunctor a Unfortunately, foralls are not allowed in class or instance contexts... -- Ashley Yakeley, Seattle WA