[Haskell-cafe] Plain lambda inside banana brackets in the arrow notation
Ross Paterson
ross at soi.city.ac.uk
Fri Jul 13 14:11:47 CEST 2012
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).
More information about the Haskell-Cafe
mailing list