Basement.IntegralConv

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 #

Downsize an integral value

Minimal complete definition

integralDownsizeCheck

Methods

integralDownsize :: a -> b #

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

integralDownsizeCheck :: a -> Maybe b #

#### Instances

Instances details

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

class IntegralUpsize a b where #

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 #

#### Instances

Instances details

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

intToInt64 :: Int -> Int64 #

int64ToInt :: Int64 -> Int #

wordToWord64 :: Word -> Word64 #

word64ToWord32s :: Word64 -> Word32x2 #

data Word32x2 #

2 Word32s

Constructors

Word32x2 !Word32 !Word32 |

word64ToWord :: Word64 -> Word #

wordToChar :: Word -> Char #

wordToInt :: Word -> Int #

charToInt :: Char -> Int #