[Haskell-cafe] Crash in Data.ByteString.Lazy.hPut

Don Stewart dons at galois.com
Mon Jan 28 17:35:49 EST 2008


jamie.love:
>    Ah, of course.
> 
>    Thanks. I removed the hPut and it runs smoothly.  I had forgotten that
>    haskell chooses the types dynamically.
> 
>    Shouldn't haskell pick up that there is no 'mod' for Word8?  I mean,
>    shouldn't I get a nicer error message?

Well, it inferred Word8 for your generated values, so 256 overflowed to 0.
Stating the expected type here would prevent that. (And is why mandatory 
top level declarations are good -- they can prevent bugs caused by 
an unexpected type being inferred).


More information about the Haskell-Cafe mailing list