[Haskell-cafe] Crash in Data.ByteString.Lazy.hPut
Jamie Love
jamie.love at aviarc.com.au
Mon Jan 28 17:45:50 EST 2008
Just to clarify, I know it was my mistake, and so I'm not blaming
Haskell or Ghc. The first few times you realise the compiler isn't a
magic wand that stops you being silly are the hardest.
Jamie Love wrote:
> Oh, I see
>
> I wasn't thinking through the code (and I'm still in the honeymoon
> phase with Haskell, thinking it can do no wrong).
>
> Don Stewart wrote:
>> 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).
>>
------------------------------------------------------------
This message has been scanned for viruses and dangerous content
by MailScanner and is believed to be clean.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080129/78730d96/attachment.htm
More information about the Haskell-Cafe
mailing list