Problem 12 Solutions
Solution 1
List.concatMap makes this easy.
rleDecode : List (RleCode a) -> List a
rleDecode list =
List.concatMap f list
f : RleCode a -> List a
f code =
case code of
Single x ->
[ x ]
Run n x ->
List.repeat n x