[Haskell-cafe] Why this exception occurs ?

Paul Johnson paul at cogito.org.uk
Fri May 25 06:50:53 EDT 2007


L.Guo wrote:
> Without thinking about for Word8, [1,18..256] is equal to [1,18..0]. Though
> I try to use "$!" to let GHC generate the list as Integer. It would not do so.
$! merely forces evaluation; it doesn't change the types.

What you want is more like:

ws: [Word8]
ws = map fromIntegral [1,18..256 :: Int]


There is no need for multi-precision Integers here: Int will do just fine.

Paul.


More information about the Haskell-Cafe mailing list