~jaro/balkon

ref: 0cf536ef34fcaf0c4f02e9dd4dc47523a47f631f balkon/test/Data/Text/ParagraphLayout/RunLengthEncoding.hs -rw-r--r-- 326 bytes
0cf536efJaro Add internal structure for vertical offsets. 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
module Data.Text.ParagraphLayout.RunLengthEncoding (runLengthDecode) where

-- | Decode a run-length encoded list.
--
-- Helpful for concisely representing lists with many repeated values.
runLengthDecode :: [(Int, a)] -> [a]
runLengthDecode [] = []
runLengthDecode ((len, val) : xs) = replicate len val ++ runLengthDecode xs