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) : (applyAll fs x)
Is there a better way to do it?
This function actually already exists as a special case of a monadic function:
applyAll :: [a -> b] -> a -> [b]
applyAll = sequence
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With