In article <[EMAIL PROTECTED]>,
 Ross Paterson <[EMAIL PROTECTED]> 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

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to