[commit: ghc] wip/tdammers/T11066: base: Improve zip documentation (258b383)

git at git.haskell.org git at git.haskell.org
Wed May 30 10:46:37 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/tdammers/T11066
Link       : http://ghc.haskell.org/trac/ghc/changeset/258b3835e03cdc5893bdf79d3565a0658b7f5f8f/ghc

>---------------------------------------------------------------

commit 258b3835e03cdc5893bdf79d3565a0658b7f5f8f
Author: Taylor Fausak <taylor at fausak.me>
Date:   Tue May 22 09:29:43 2018 -0400

    base: Improve zip documentation


>---------------------------------------------------------------

258b3835e03cdc5893bdf79d3565a0658b7f5f8f
 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