[commit: ghc] master: base: Improve zip documentation (576078a)
git at git.haskell.org
git at git.haskell.org
Tue May 29 20:57:49 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/576078a8a126f24c3dfdd16e2b6d1db50dd9050f/ghc
>---------------------------------------------------------------
commit 576078a8a126f24c3dfdd16e2b6d1db50dd9050f
Author: Taylor Fausak <taylor at fausak.me>
Date: Tue May 22 09:29:43 2018 -0400
base: Improve zip documentation
>---------------------------------------------------------------
576078a8a126f24c3dfdd16e2b6d1db50dd9050f
libraries/base/GHC/List.hs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs
index af50213..793ff49 100644
--- a/libraries/base/GHC/List.hs
+++ b/libraries/base/GHC/List.hs
@@ -947,12 +947,19 @@ foldr2_left k _z x r (y:ys) = k x y (r ys)
----------------------------------------------
-- | 'zip' takes two lists and returns a list of corresponding pairs.
+--
+-- > zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
+--
-- If one input list is short, excess elements of the longer list are
--- discarded.
+-- discarded:
+--
+-- > zip [1] ['a', 'b'] = [(1, 'a')]
+-- > zip [1, 2] ['a'] = [(1, 'a')]
--
-- 'zip' is right-lazy:
--
-- > zip [] _|_ = []
+-- > zip _|_ [] = _|_
{-# NOINLINE [1] zip #-}
zip :: [a] -> [b] -> [(a,b)]
zip [] _bs = []
More information about the ghc-commits
mailing list