{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}

-- |
-- Module    :  Data.Int.Checked
-- Copyright :  (c) Antoine Latter 2008
-- License   :  BSD3
--
-- Maintainer:  Antoine Latter <aslatter@gmail.com>
-- Stability :  provisional
-- Portability: portable  -- requires GeneralizedNewtypeDeriving
--
-- A drop-in replacements for the Data.Int types.
-- Exceptions are thrown whenever an operation would over-flow.
--

module Data.Int.Checked(Int()
                       ,Int8()
                       ,Int16()
                       ,Int32()
                       ,Int64()
                       ) where

import Prelude hiding (Int)
import qualified Data.Int as I
import Control.Exception(assert)

import Data.Typeable
import Foreign.Storable (Storable)
import Text.Printf (PrintfArg)
import Data.Ix (Ix)
-- import Data.Generics.Basics (Data)
import Data.Bits (Bits)

#include "checked.h"

CHECKED_WRAPPER(Int,   I,   I.Int)
CHECKED_WRAPPER(Int8,  I8,  I.Int8)
CHECKED_WRAPPER(Int16, I16, I.Int16)
CHECKED_WRAPPER(Int32 ,I32, I.Int32)
CHECKED_WRAPPER(Int64, I64, I.Int64)