[commit: ghc] master: Extend the docs for Data.List.transpose (c5977c2)
git at git.haskell.org
git at git.haskell.org
Mon Mar 2 09:54:03 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b/ghc
>---------------------------------------------------------------
commit c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Mon Mar 2 10:55:22 2015 +0100
Extend the docs for Data.List.transpose
by giving a sufficient general example to explain what happens when the
rows are not of the same lengths. Thanks to Doug McIlroy for the
suggestoin. Fixes #10128.
>---------------------------------------------------------------
c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b
libraries/base/Data/OldList.hs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index 137ce42..7e79c34 100644
--- a/libraries/base/Data/OldList.hs
+++ b/libraries/base/Data/OldList.hs
@@ -468,6 +468,10 @@ intercalate xs xss = concat (intersperse xs xss)
-- For example,
--
-- > transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]]
+--
+-- If some of the rows are shorter than the following rows, their elements are skipped:
+--
+-- > transpose [[10,11],[20],[],[30,31,32]] == [[10,20,30],[11,31],[32]]
transpose :: [[a]] -> [[a]]
transpose [] = []
More information about the ghc-commits
mailing list