Last active
January 26, 2017 10:40
-
-
Save clojj/7daac2bd510e50275db249292cbc36f6 to your computer and use it in GitHub Desktop.
compose list of Maybe functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.List | |
| compose :: [Maybe (a -> a)] -> a -> a | |
| compose fs v = foldl' compf id fs $ v | |
| compf :: (a -> a) -> Maybe (a -> a) -> (a -> a) | |
| compf f mg = | |
| case mg of | |
| Nothing -> f | |
| Just g -> g . f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment