~jaro/balkon

ref: d5253a67c07ac5f110471f7644c55b5ef40695ba balkon/test/Data/Text/ParagraphLayout/RunLengthEncoding.hs -rw-r--r-- 326 bytes
d5253a67Jaro Do not pass around text direction unnecessarily. 1 year, 6 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