summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/List.hs
diff options
context:
space:
mode:
authorTaylor Fausak <taylor@fausak.me>2018-05-22 09:29:43 -0400
committerBen Gamari <ben@smart-cactus.org>2018-05-29 16:37:58 -0400
commit576078a8a126f24c3dfdd16e2b6d1db50dd9050f (patch)
tree8af050b8d5d36bc95a8a68ebf47b8f23e6e5cf56 /libraries/base/GHC/List.hs
parent9969863adbd8f467d029254b5520c3340dacd980 (diff)
downloadhaskell-576078a8a126f24c3dfdd16e2b6d1db50dd9050f.tar.gz
base: Improve zip documentation
Diffstat (limited to 'libraries/base/GHC/List.hs')
-rw-r--r--libraries/base/GHC/List.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs
index af502134a7..793ff499e8 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 = []