basement-0.0.16: Foundation scrap box of array & string

Safe Haskell | None
Language | Haskell2010

Basement.IntegralConv

Synopsis

- class IntegralDownsize a b where
  - integralDownsize :: a -> b
  - integralDownsizeCheck :: a -> Maybe b
- class IntegralUpsize a b where
  - integralUpsize :: a -> b
- intToInt64 :: Int -> Int64
- int64ToInt :: Int64 -> Int
- wordToWord64 :: Word -> Word64
- word64ToWord32s :: Word64 -> Word32x2
- data Word32x2 = Word32x2 !Word32 !Word32
- word64ToWord :: Word64 -> Word
- wordToChar :: Word -> Char
- wordToInt :: Word -> Int
- charToInt :: Char -> Int

# Documentation

class IntegralDownsize a b where Source #

Downsize an integral value

Minimal complete definition

integralDownsizeCheck

Methods

integralDownsize :: a -> b Source #

default integralDownsize :: a ~ b => a -> b Source #

integralDownsizeCheck :: a -> Maybe b Source #

#### Instances

Instances details

IntegralDownsize Int64 Int16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int64 -> Int16 Source # integralDownsizeCheck :: Int64 -> Maybe Int16 Source #
IntegralDownsize Int64 Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int64 -> Int32 Source # integralDownsizeCheck :: Int64 -> Maybe Int32 Source #
IntegralDownsize Int64 Int8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int64 -> Int8 Source # integralDownsizeCheck :: Int64 -> Maybe Int8 Source #
IntegralDownsize Int64 Int Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int64 -> Int Source # integralDownsizeCheck :: Int64 -> Maybe Int Source #
IntegralDownsize Word16 Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word16 -> Word8 Source # integralDownsizeCheck :: Word16 -> Maybe Word8 Source #
IntegralDownsize Word32 Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word32 -> Word16 Source # integralDownsizeCheck :: Word32 -> Maybe Word16 Source #
IntegralDownsize Word32 Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word32 -> Word8 Source # integralDownsizeCheck :: Word32 -> Maybe Word8 Source #
IntegralDownsize Word64 Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word64 -> Word16 Source # integralDownsizeCheck :: Word64 -> Maybe Word16 Source #
IntegralDownsize Word64 Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word64 -> Word32 Source # integralDownsizeCheck :: Word64 -> Maybe Word32 Source #
IntegralDownsize Word64 Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word64 -> Word8 Source # integralDownsizeCheck :: Word64 -> Maybe Word8 Source #
IntegralDownsize Integer Int16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Int16 Source # integralDownsizeCheck :: Integer -> Maybe Int16 Source #
IntegralDownsize Integer Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Int32 Source # integralDownsizeCheck :: Integer -> Maybe Int32 Source #
IntegralDownsize Integer Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Int64 Source # integralDownsizeCheck :: Integer -> Maybe Int64 Source #
IntegralDownsize Integer Int8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Int8 Source # integralDownsizeCheck :: Integer -> Maybe Int8 Source #
IntegralDownsize Integer Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Word16 Source # integralDownsizeCheck :: Integer -> Maybe Word16 Source #
IntegralDownsize Integer Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Word32 Source # integralDownsizeCheck :: Integer -> Maybe Word32 Source #
IntegralDownsize Integer Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Word64 Source # integralDownsizeCheck :: Integer -> Maybe Word64 Source #
IntegralDownsize Integer Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Word8 Source # integralDownsizeCheck :: Integer -> Maybe Word8 Source #
IntegralDownsize Integer Natural Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Integer -> Natural Source # integralDownsizeCheck :: Integer -> Maybe Natural Source #
IntegralDownsize Natural Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word16 Source # integralDownsizeCheck :: Natural -> Maybe Word16 Source #
IntegralDownsize Natural Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word32 Source # integralDownsizeCheck :: Natural -> Maybe Word32 Source #
IntegralDownsize Natural Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word64 Source # integralDownsizeCheck :: Natural -> Maybe Word64 Source #
IntegralDownsize Natural Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Natural -> Word8 Source # integralDownsizeCheck :: Natural -> Maybe Word8 Source #
IntegralDownsize Int Int16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int -> Int16 Source # integralDownsizeCheck :: Int -> Maybe Int16 Source #
IntegralDownsize Int Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int -> Int32 Source # integralDownsizeCheck :: Int -> Maybe Int32 Source #
IntegralDownsize Int Int8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Int -> Int8 Source # integralDownsizeCheck :: Int -> Maybe Int8 Source #
IntegralDownsize Word Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word -> Word16 Source # integralDownsizeCheck :: Word -> Maybe Word16 Source #
IntegralDownsize Word Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word -> Word32 Source # integralDownsizeCheck :: Word -> Maybe Word32 Source #
IntegralDownsize Word Word8 Source # |
Instance details Defined in Basement.IntegralConv Methods integralDownsize :: Word -> Word8 Source # integralDownsizeCheck :: Word -> Maybe Word8 Source #

class IntegralUpsize a b where Source #

Upsize an integral value

The destination type `b` size need to be greater or equal than the size type of `a`

Methods

integralUpsize :: a -> b Source #

#### Instances

Instances details

IntegralUpsize Int16 Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int16 -> Int32 Source #
IntegralUpsize Int16 Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int16 -> Int64 Source #
IntegralUpsize Int16 Int Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int16 -> Int Source #
IntegralUpsize Int32 Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int32 -> Int64 Source #
IntegralUpsize Int32 Int Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int32 -> Int Source #
IntegralUpsize Int8 Int16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int8 -> Int16 Source #
IntegralUpsize Int8 Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int8 -> Int32 Source #
IntegralUpsize Int8 Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int8 -> Int64 Source #
IntegralUpsize Int8 Int Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int8 -> Int Source #
IntegralUpsize Word16 Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word16 -> Word32 Source #
IntegralUpsize Word16 Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word16 -> Word64 Source #
IntegralUpsize Word16 Word Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word16 -> Word Source #
IntegralUpsize Word32 Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word32 -> Word64 Source #
IntegralUpsize Word32 Word Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word32 -> Word Source #
IntegralUpsize Word8 Int16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Int16 Source #
IntegralUpsize Word8 Int32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Int32 Source #
IntegralUpsize Word8 Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Int64 Source #
IntegralUpsize Word8 Word16 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Word16 Source #
IntegralUpsize Word8 Word32 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Word32 Source #
IntegralUpsize Word8 Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Word64 Source #
IntegralUpsize Word8 Int Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Int Source #
IntegralUpsize Word8 Word Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Word Source #
IntegralUpsize Int Int64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Int -> Int64 Source #
IntegralUpsize Word Word64 Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word -> Word64 Source #
IsIntegral a => IntegralUpsize a Integer Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: a -> Integer Source #
IsNatural a => IntegralUpsize a Natural Source # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: a -> Natural Source #

intToInt64 :: Int -> Int64 Source #

int64ToInt :: Int64 -> Int Source #

wordToWord64 :: Word -> Word64 Source #

word64ToWord32s :: Word64 -> Word32x2 Source #

data Word32x2 Source #

2 Word32s

Constructors

Word32x2 !Word32 !Word32 |

word64ToWord :: Word64 -> Word Source #

wordToChar :: Word -> Char Source #

wordToInt :: Word -> Int Source #

charToInt :: Char -> Int Source #