safeint-0.5: overflow-checked Int type

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerAndres Loeh <andres@well-typed.com>

Data.SafeInt

Description

Defines a variant of Haskell's Int type that is overflow-checked. If an overflow or arithmetic error occurs, a run-time exception is thrown.

Documentation

newtype SafeInt Source

Constructors

SI Int 

Instances

Bounded SafeInt 
Enum SafeInt 
Eq SafeInt 
Integral SafeInt 
Num SafeInt

In the Num instance, we plug in our own addition, multiplication and subtraction function that perform overflow-checking.

Ord SafeInt 
Read SafeInt 
Real SafeInt 
Show SafeInt