[email protected]
[Top] [All Lists]

[Haskell-cafe] Re: (liftM join .) . mapM

Subject: [Haskell-cafe] Re: (liftM join .) . mapM
From: Dominic Steinitz
Date: Tue, 29 Dec 2009 21:09:46 +0000 UTC
Stephen Tetley <stephen.tetley <at> gmail.com> writes:

> -- | Compose an arity 1 function with an arity 2 function.
> -- B1 - blackbird
> oo :: (c -> d) -> (a -> b -> c) -> a -> b -> d
> oo f g = (f .) . g
> 
> Extending the arity works quite nicely too:
> 
> -- | Compose an arity 1 function with an arity 3 function.
> -- B2 - bunting
> ooo :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
> ooo f g = ((f .) .) . g

And oo = (.).(.) and ooo = (.).(.).(.)

There was a suggestion a few years back to standardise these as I recall
something like:

 $0 = $
 $1 = .
 $2 = (.).(.)

and so on but nothing came of it.

Dominic.



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

<Prev in Thread] Current Thread [Next in Thread>