[commit: ghc] ghc-7.10: Extend the docs for Data.List.transpose (bbc36b3)

git at git.haskell.org git at git.haskell.org
Mon Mar 9 18:54:46 UTC 2015


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

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/bbc36b3e05c6d3078be7a8737c317d2d609317f7/ghc

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

commit bbc36b3e05c6d3078be7a8737c317d2d609317f7
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.
    
    (cherry picked from commit c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b)


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

bbc36b3e05c6d3078be7a8737c317d2d609317f7
 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