Adding swap/compose functions to Data.Tuple and Data.Function

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Fri Nov 23 16:43:02 CET 2012


John Wiegley wrote:
> Fairly obvious, but strangely missing.
> 
>     compose :: [(a -> a)] -> a -> a
>     compose = foldr (.) id

-0.5

>     composeM :: [(a -> m a)] -> a -> m a
>     composeM = foldr (<=<) return

-1

For some reason I would actually expect  foldr (>=>) return. Either
variant is bound to cause confusion for some people.

Bertram



More information about the Libraries mailing list