Created
July 2, 2018 01:27
-
-
Save oisdk/cfb418b9be8b73d4a0e898ec64e497cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Functor.Foldable | |
zipo :: (Recursive f, Recursive g) | |
=> (Base f (g -> c) -> Base g g -> c) | |
-> f -> g -> c | |
zipo alg xs = cata (\x -> alg x . project) xs | |
zipoFix :: Functor f => (f (Fix f -> a) -> f (Fix f) -> a) -> Fix f -> Fix f -> a | |
zipoFix = zipo | |
zip :: [a] -> [b] -> [(a,b)] | |
zip = zipo alg | |
where | |
alg Nil _ = [] | |
alg _ Nil = [] | |
alg (Cons x xs) (Cons y ys) = (x,y) : xs ys |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment