1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

🔥 zipDefaults.

This commit is contained in:
Rob Rix 2016-03-11 01:06:09 -05:00
parent 693f91b93c
commit cd844d7a00

View File

@ -27,10 +27,6 @@ snd = Prelude.snd . runBoth
zip :: Both [a] -> [Both a]
zip = zipWith both
-- | Zip Both lists, using the default values to extend the shorter list.
zipDefaults :: Both a -> Both [a] -> [Both a]
zipDefaults ds as = take (runBothWith max (length <$> as)) $ zipWith both ((++) <$> as <*> (repeat <$> ds))
zipWith :: (a -> a -> b) -> Both [a] -> [b]
zipWith _ (Both ([], _)) = []
zipWith _ (Both (_, [])) = []