@@ -5,6 +5,7 @@ import Prelude.List
55import Prelude.Chars
66import Prelude.Cast
77import Prelude.Either
8+import Prelude.Foldable
89
910-- Some more complex string operations
1011
@@ -38,9 +39,8 @@ unpack s with (strM s)
3839 unpack "" | StrNil = []
3940 unpack (strCons x xs) | (StrCons x xs) = x :: unpack xs
4041
41−pack : List Char -> String
42−pack [] = ""
43−pack (x :: xs) = strCons x (pack xs)
42+pack : (Foldable t) => t Char -> String
43+pack = foldr strCons ""
4444
4545instance Cast String (List Char) where
4646 cast = unpack