Created
March 9, 2013 02:29
-
-
Save anonymous/5122217 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
data StartsWithA a b = StartsWithA a (StartsWithB a b) | |
| EmptyA | |
deriving Show | |
data StartsWithB a b = StartsWithB b (StartsWithA a b) | |
| EmptyB | |
deriving Show | |
infixr 7 <<< | |
infixr 7 >>> | |
x >>> y = StartsWithA x y | |
x <<< y = StartsWithB x y | |
zipAB :: [a] -> [b] -> StartsWithA a b | |
zipAB (a : as) (b: bs) = a >>> (b <<< (zipAB as bs)) | |
zipAB (a : as) _ = a >>> EmptyB | |
zipAB _ _ = EmptyA | |
main = putStrLn $ show $ (zipAB ["a", "b", "c"] [1, 2, 3], zipAB ["a", "b", "c"] [1, 2], zipAB ["a", "b"] [1, 2, 3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment