[Haskell-cafe] Basic problem in Haskell language design?

Nicu Ionita nicu.ionita at acons.at
Sun Mar 1 08:26:42 EST 2009


Today I found the following problem when writing a simple function:

> -- Whole info from a word8 list to moves
> movesFromWord8s :: [Word8] -> [Move]
> movesFromWord8s (f:t:ws) = (f, t) : movesFromWord8s ws
> moverFromWord8s _ = []

Here I made a small typo in the second equation, writing "mover..." instead
of "moves..." for the name of the declared function. Of course this is an
error, because I have non-exhaustive patterns in the function
movesFromWord8s. But the compiler (here GHC 6.8.2 on WinXP) has in principle
no chance to detect this mistake, I saw it only in QuickCheck (aka at

I think this is a basic problem with the language design. In small programs
it's not so bad, but in large ones this could be. What do you think about
it? Are there possible solutions or workarounds?

Nicu Ionita

More information about the Haskell-Cafe mailing list