Skip to content

Instantly share code, notes, and snippets.

@minikomi
Created October 24, 2014 12:21
Show Gist options
  • Save minikomi/917289c6c5e377803c7c to your computer and use it in GitHub Desktop.
Save minikomi/917289c6c5e377803c7c to your computer and use it in GitHub Desktop.
traverse.purs
let isOdd x = case x % 2 of
0 -> Nothing
_ -> Just x
traverse (\ x -> isOdd x) [3,5,7,9]
-- Just ([3,5,7,9])
sequence $ map (\ x -> isOdd x) [3,5,7,9]
-- Just ([3,5,7,9])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment