Skip to content

Instantly share code, notes, and snippets.

@punund
Last active October 30, 2015 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punund/f62cbe414d4f2cb15374 to your computer and use it in GitHub Desktop.
Save punund/f62cbe414d4f2cb15374 to your computer and use it in GitHub Desktop.
List monad in action
{- монада это необязательно последовательное исполнение -}
import Control.Monad
newlist ∷ [(Int, Int)]
newlist =
do x <- [1..3]
y <- [11..12]
guard $ x + y > 13
return (x, y)
-- newlist will be [(2,12),(3,11),(3,12)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment