I need to define a function \'Compose\' which takes a list \'L\' which is a list of functions. When I specify a parameter that will suit all the functions in the list, the l
The same using monoids, point-free
import Data.Monoid compose :: [a -> a] -> a -> a compose = appEndo . mconcat . map Endo
Or somewhat more generally:
import Data.Monoid compose :: (Functor t, Foldable t) => t (a -> a) -> a -> a compose = appEndo . foldl1 (<>) . fmap Endo