Skip to content

Instantly share code, notes, and snippets.

@onlyshk
Created December 7, 2011 07:24
Show Gist options
  • Save onlyshk/1441848 to your computer and use it in GitHub Desktop.
Save onlyshk/1441848 to your computer and use it in GitHub Desktop.
list lifting
plus :: [Int] -> [Int] -> [Int]
plus = liftM2 (+)
-- plus [1,2,3] [3,6,9] ---> [4,7,10, 5,8,11, 6,9,12]
-- plus [1..] [] ---> _|_ (i.e., keeps on calculating forever)
-- plus [] [1..] ---> []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment