Skip to content

Instantly share code, notes, and snippets.

@metametaclass
Created November 30, 2012 14:52
Show Gist options
  • Select an option

  • Save metametaclass/4176214 to your computer and use it in GitHub Desktop.

Select an option

Save metametaclass/4176214 to your computer and use it in GitHub Desktop.
module Main where
import Control.Monad(join)
table = [(1, "a", "b"),
(0, "c", "d"),
(2, "e", "f")]
query = do (x,y,z) <- table
join $ if x<1 then return [x]
else return [x, -x]
query1 = do
(x,y,z) <- table
if x<1 then [x] else [x, -x]
main = do print query
print query1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment