unwitch-3.0.0: converts between primitives
Safe HaskellNone
LanguageHaskell2010

Unwitch.Convert.CInt

Contents

Description

Conversions from CInt. CInt is GHC-specific (wraps Int32 in GHC, Int in MicroHs), so this module is only available under GHC.

Synopsis

Conversions

toInt8 :: CInt -> Maybe Int8 Source #

Narrowing conversion, fails if outside Int8 range.

toInt16 :: CInt -> Maybe Int16 Source #

Narrowing conversion, fails if outside Int16 range.

toInt32 :: CInt -> Int32 Source #

Unwrap the underlying Int32.

toInt64 :: CInt -> Int64 Source #

Widening conversion, always succeeds.

toInt :: CInt -> Int Source #

Total conversion, Int is at least 32 bits wide.

toInteger :: CInt -> Integer Source #

Total conversion to Integer.

toWord8 :: CInt -> Maybe Word8 Source #

Signed-to-unsigned narrowing, fails if negative or out of range.

toWord16 :: CInt -> Maybe Word16 Source #

Signed-to-unsigned narrowing, fails if negative or out of range.

toWord32 :: CInt -> Maybe Word32 Source #

Signed-to-unsigned, fails if negative.

toWord64 :: CInt -> Maybe Word64 Source #

Signed-to-unsigned, fails if negative.

toWord :: CInt -> Maybe Word Source #

Signed-to-unsigned, fails if negative.

toNatural :: CInt -> Either Overflows Natural Source #

Signed-to-unsigned, returns Left Underflow for negative values.

toFloat :: CInt -> Either Overflows Float Source #

Checked conversion, fails if outside exact float integer range (+-16777215).

toDouble :: CInt -> Double Source #

Total conversion, all Int32 values are exactly representable as Double.