Skip to content

Instantly share code, notes, and snippets.

@dennisvennink
Created November 1, 2018 04:01
Show Gist options
  • Save dennisvennink/fc5f2bc99ddf75ae9fb50efa4fe748dd to your computer and use it in GitHub Desktop.
Save dennisvennink/fc5f2bc99ddf75ae9fb50efa4fe748dd to your computer and use it in GitHub Desktop.
zipLongest :: [a] -> [b] -> [(Maybe a, Maybe b)]
zipLongest [] [] = []
zipLongest [] (y:ys) = [(Nothing, Just y)] ++ zipLongest [] ys
zipLongest (x:xs) [] = [(Just x, Nothing)] ++ zipLongest xs []
zipLongest (x:xs) (y:ys) = [(Just x, Just y)] ++ zipLongest xs ys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment