| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Unwitch.Convert.Word
Contents
Description
Conversions from Word.
Synopsis
- toWord8 :: Word -> Maybe Word8
- toWord16 :: Word -> Maybe Word16
- toWord32 :: Word -> Maybe Word32
- toWord64 :: Word -> Word64
- toNatural :: Word -> Natural
- toInt8 :: Word -> Maybe Int8
- toInt16 :: Word -> Maybe Int16
- toInt32 :: Word -> Maybe Int32
- toInt64 :: Word -> Maybe Int64
- toInt :: Word -> Maybe Int
- toInteger :: Word -> Integer
- toFloat :: Word -> Either Overflows Float
- toDouble :: Word -> Either Overflows Double
- toCInt :: Word -> Maybe CInt
- toWord8# :: Word -> (# Word8 | (# #) #)
- toWord16# :: Word -> (# Word16 | (# #) #)
- toWord32# :: Word -> (# Word32 | (# #) #)
- toInt8# :: Word -> (# Int8 | (# #) #)
- toInt16# :: Word -> (# Int16 | (# #) #)
- toInt32# :: Word -> (# Int32 | (# #) #)
- toInt64# :: Word -> (# Int64 | (# #) #)
- toInt# :: Word -> (# Int | (# #) #)
- toFloat# :: Word -> (# Overflows | Float #)
- toDouble# :: Word -> (# Overflows | Double #)
Conversions
toFloat :: Word -> Either Overflows Float Source #
Checked conversion, fails if outside exact float integer range (+-16777215).
toDouble :: Word -> Either Overflows Double Source #
Checked conversion, fails if outside exact double integer range (+-9007199254740991).
Unboxed conversions
These use GHC unboxed types and unboxed sums for zero-allocation
failure handling. Requires the MagicHash, UnboxedSums and
UnboxedTuples language extensions.
See the GHC manual on unboxed types.