Skip to content

Instantly share code, notes, and snippets.

@dripolles
Created April 3, 2014 08:42
Show Gist options
  • Save dripolles/9950705 to your computer and use it in GitHub Desktop.
Save dripolles/9950705 to your computer and use it in GitHub Desktop.
1HaskellADay 2014/04/03
import Control.Applicative
import Control.Arrow
foo :: (a -> b) -> [a] -> [(a,b)]
foo f = map ((,) <$> id <*> f)
foo' :: (a -> b) -> [a] -> [(a,b)]
foo' = map . (id &&&)
main = do
print $ foo (>1) [0..4]
print $ foo' (>1) [0..4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment