{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-} -- | -- Module : Data.Word.Checked -- Copyright : (c) Antoine Latter 2008 -- License : BSD3 -- -- Maintainer: Antoine Latter -- Stability : provisional -- Portability: portable -- requires GeneralizedNewtypeDeriving -- -- A drop-in replacements for the Data.Word types. -- Exceptions are thrown whenever an operation would over-flow. -- module Data.Word.Checked(Word() ,Word8() ,Word16() ,Word32() ,Word64() ) where import qualified Data.Word as W 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(Word, W, W.Word) CHECKED_WRAPPER(Word8, W8, W.Word8) CHECKED_WRAPPER(Word16, W16, W.Word16) CHECKED_WRAPPER(Word32, W32, W.Word32) CHECKED_WRAPPER(Word64, W64, W.Word64)