
26 Mar
2010
26 Mar
'10
10:51 p.m.
On Fri, Mar 26, 2010 at 1:23 PM, Ashish Agarwal
Is there an alternative implementation of the types Word8, Word16, etc. that disallow overflow? For example, currently: Prelude Word> (fromInteger 256) :: Word8 0 I'd like a type whose constructors disallow this.
In a way. There's this: http://hackage.haskell.org/package/checked Which provides replacements for all of the Word/Int types, except it always errors on overflow. It's not intended for production use, as it adds quite a bit of overhead to evaluation. In retrospect, I'm not sure why I didn't use Control.Exception.assert. Antoine