Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jjthrash/123750 to your computer and use it in GitHub Desktop.
Save jjthrash/123750 to your computer and use it in GitHub Desktop.
-- Dumb way (list monad):
combine = do
a <- list1
b <- list2
c <- list3
return [a, b, c]
-- OK way (list monad):
combinations xs = mapM (>>=) .... ?????
-- Right way (list comprehensions):
combinations [] = [[]]
combinations (xs:xss) = [ x:y | x <- xs, y <- combinations xss ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment