I wrote a function that applies a list of functions to an item.
applyAll :: [a -> b] -> a -> [b]
applyAll [] _ = []
applyAll (f:fs) x = (f x) : (a
Lee's solution is what I'd recommend, but this reads perhaps even nicer:
import Control.Applicative
applyAll' fs v = fs <*> pure v
or
applyAll'' fs v = fs <*> [v]
This sort of makes stuff more complicated than necessary, though: we really only need the Functor
instance of lists, whereas applyAll'
injects and immediately extracts from the Applicative
instance.