[Haskell-cafe] Why this exception occurs ?

Donald Bruce Stewart dons at cse.unsw.edu.au
Fri May 25 03:33:43 EDT 2007


dons:
> leaveye.guo:
> > Hi.
> > 
> > In GHCi ver 6.6, why this happens ?
> > 
> > Prelude Data.ByteString> Data.ByteString.pack $! Prelude.map (`rem` 256) $ [0..511]
> > "*** Exception: divide by zero
> 
> It's the use of `rem` on Word8, by the way:
> 
>     Prelude> (0 `rem` 256) :: Data.Word.Word8 
>     *** Exception: divide by zero
> 

Sorry, I should clarify, think about how to represent:

    256 :: Word8

;-)

-- Don


More information about the Haskell-Cafe mailing list