Skip to content

Instantly share code, notes, and snippets.

@bluescreen303
Created September 8, 2010 20:26
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 bluescreen303/570775 to your computer and use it in GitHub Desktop.
Save bluescreen303/570775 to your computer and use it in GitHub Desktop.
module Main where
partEither list = helper list ([],[])
where
helper [] (l,r) = (reverse l,reverse r)
helper ((Left a):xs) (l,r) = helper xs (a:l,r)
helper ((Right b):xs) (l,r) = helper xs (l,b:r)
test = iterate (\(Left x) -> Left (x+1)) (Left 0)
main = do
let (l,r) = partEither test
mapM_ print (take 10 l)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment