ref: c3d5b2a4be56b65a09e0e52c01a4646ce407302b
parent: a92b259db04fb77944858dbc660bafbc30677a9e
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Thu Nov 30 10:06:17 EST 2023
Add zip3
--- a/lib/Data/List.hs
+++ b/lib/Data/List.hs
@@ -155,9 +155,16 @@
zip :: forall a b . [a] -> [b] -> [(a, b)]
zip = zipWith (\ x y -> (x, y))
+zip3 :: forall a b c . [a] -> [b] -> [c] -> [(a, b, c)]
+zip3 = zipWith3 (\ x y z -> (x, y, z))
+
zipWith :: forall a b c . (a -> b -> c) -> [a] -> [b] -> [c]
zipWith f (x:xs) (y:ys) = f x y : zipWith f xs ys
zipWith _ _ _ = []
+
+zipWith3 :: forall a b c d . (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
+zipWith3 f (x:xs) (y:ys) (z:zs) = f x y z : zipWith3 f xs ys zs
+zipWith3 _ _ _ _ = []
-- XXX not as lazy as it could be
unzip :: forall a b . [(a, b)] -> ([a], [b])
--
⑨