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

Dominic Steinitz dominic at steinitz.org
Tue Dec 29 16:09:46 EST 2009


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.





More information about the Haskell-Cafe mailing list