Skip to content

Instantly share code, notes, and snippets.

@abuiles
Created October 26, 2009 21:27
Show Gist options
  • Save abuiles/219056 to your computer and use it in GitHub Desktop.
Save abuiles/219056 to your computer and use it in GitHub Desktop.
newtype ZipList a = ZipList { getZipList :: [a] }
instance Functor ZipList where
fmap g (ZipList a) = ZipList $ fmap g a
instance Applicative ZipList where
pure a = ZipList [a]
(ZipList fs) <*> (ZipList xs) = ZipList $ zipWith ($) fs xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment