summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-03-02 10:55:22 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2015-03-02 10:55:22 +0100
commitc5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b (patch)
treeed9693d2225cff0b6f287742befefa5c5689ff1c /libraries
parent1def53fec6a6ef985de0e665fede4744dfd456fb (diff)
downloadhaskell-c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b.tar.gz
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.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Data/OldList.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs
index 137ce42150..7e79c347d4 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 [] = []