Arrow Classes
Ashley Yakeley
ashley@semantic.org
Thu, 10 Jul 2003 22:34:45 -0700
In article <20030710133324.GA2318@soi.city.ac.uk>,
Ross Paterson <ross@soi.city.ac.uk> wrote:
> 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