GHC panic
data RunLength = Single Char | Multiple (Char, Int) deriving(show)
encode' :: String -> [RunLength]
encode' [] = []
encode' (x:xs) = if len == 1 then Single x : encode' xs else
Multiple (x, len) : encode' rest
where (first, rest) = span (==x) xs
len = length first
[1 of 1] Compiling Main ( 99_1.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 7.4.2 for x86_64-apple-darwin):
nameModule show{tv abq4}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
I notice I mistyped Show
as show
, but I think it's better to report it since the compiler doesnt catch the error