Created
February 12, 2016 04:07
-
-
Save kseo/a61c058042ab53ac56c1 to your computer and use it in GitHub Desktop.
Monad comprehension
This file contains 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
-- https://ghc.haskell.org/trac/ghc/wiki/MonadComprehensions | |
{-# LANGUAGE MonadComprehensions #-} | |
import Control.Monad | |
mapl :: Monad m => (a -> m b) -> ([a] -> m [b]) | |
mapl f [] = return [] | |
mapl f (x:xs) = [y:ys | y <- f x, ys <- mapl f xs] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment