safeint-0.6: overflow-checked Int type

Copyright(c) 2010 Well-Typed LLP
LicenseBSD3
MaintainerAndres Loeh <andres@well-typed.com>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellNone
LanguageHaskell2010

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 Source 
Enum SafeInt Source 
Eq SafeInt Source 
Integral SafeInt Source 
Num SafeInt Source

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

Ord SafeInt Source 
Read SafeInt Source 
Real SafeInt Source 
Show SafeInt Source