On Thu, Jul 12, 2012 at 02:47:57PM +0100, Ross Paterson wrote: > Though one possibility that might get > us most of the way there would be to refactor the Arrow class as > > class PreArrow a where > premap :: (b -> b') -> a b' c -> a b c > > class (Category a, PreArrow a) => Arrow a where > arr :: (b -> c) -> a b c > arr f = premap f id > > first :: a b c -> a (b,d) (c,d)
I've done this and the associated GHC changes locally; it yields a simple rule for determining which instances are needed, based on the keywords used: * all commands ("proc" and operator arguments) need PreArrow * "do" needs Arrow * "rec" needs ArrowLoop * "case" or "if" need ArrowChoice I'm warming to it as a worthwhile generalization (though not exactly what was asked for). _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe