Basement.Compat.Primitive

basement-0.0.16: Foundation scrap box of array & string

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | portable
Safe Haskell | None
Language | Haskell2010

Basement.Compat.Primitive

Description

Synopsis

- bool# :: Int# -> Bool
- data PinnedStatus
  - = Pinned
  - | Unpinned
- toPinnedStatus# :: Pinned# -> PinnedStatus
- compatMkWeak# :: o -> b -> IO () -> State# RealWorld -> (# State# RealWorld, Weak# b #)
- compatIsByteArrayPinned# :: ByteArray# -> Pinned#
- compatIsMutableByteArrayPinned# :: MutableByteArray# s -> Pinned#
- unsafeCoerce# :: a -> b
- data Word = W# Word#
- data Word8# :: TYPE 'Word8Rep
- data Word16# :: TYPE 'Word16Rep
- data Word32# :: TYPE 'Word32Rep
- data Int8# :: TYPE 'Int8Rep
- data Int16# :: TYPE 'Int16Rep
- data Int32# :: TYPE 'Int32Rep
- word8ToWord16# :: Word8# -> Word16#
- word8ToWord32# :: Word8# -> Word32#
- word8ToWord# :: Word8# -> Word#
- word16ToWord8# :: Word16# -> Word8#
- word16ToWord32# :: Word16# -> Word32#
- word16ToWord# :: Word16# -> Word#
- word32ToWord# :: Word32# -> Word#
- word32ToWord8# :: Word32# -> Word8#
- word32ToWord16# :: Word32# -> Word16#
- wordToWord32# :: Word# -> Word32#
- wordToWord16# :: Word# -> Word16#
- wordToWord8# :: Word# -> Word8#
- int8ToInt16# :: Int8# -> Int16#
- int8ToInt32# :: Int8# -> Int32#
- int8ToInt# :: Int8# -> Int#
- int16ToInt32# :: Int16# -> Int32#
- int16ToInt# :: Int16# -> Int#
- int32ToInt# :: Int32# -> Int#
- intToInt8# :: Int# -> Int8#
- intToInt16# :: Int# -> Int16#
- intToInt32# :: Int# -> Int32#
- word8ToInt# :: Word8# -> Int#
- word8ToInt16# :: Word8# -> Int16#
- word8ToInt32# :: Word8# -> Int32#
- charToWord32# :: Char# -> Word32#
- word8ToChar# :: Word8# -> Char#
- word16ToChar# :: Word16# -> Char#
- word32ToChar# :: Word32# -> Char#
- wordToChar# :: Word# -> Char#
- plusWord8# :: Word8# -> Word8# -> Word8#
- uncheckedShiftRLWord16# :: Word16# -> Int# -> Word16#
- plusWord16# :: Word16# -> Word16# -> Word16#
- uncheckedShiftRLWord32# :: Word32# -> Int# -> Word32#
- plusWord32# :: Word32# -> Word32# -> Word32#
- plusInt8# :: Int8# -> Int8# -> Int8#
- plusInt16# :: Int16# -> Int16# -> Int16#
- plusInt32# :: Int32# -> Int32# -> Int32#

# Documentation

bool# :: Int# -> Bool #

turn an Int# into a Bool

data PinnedStatus #

Flag record whether a specific byte array is pinned or not

Constructors

Pinned |
Unpinned |

#### Instances

Instances details

Eq PinnedStatus # |
Instance details Defined in Basement.Compat.Primitive Methods (==) :: PinnedStatus -> PinnedStatus -> Bool # (/=) :: PinnedStatus -> PinnedStatus -> Bool #

toPinnedStatus# :: Pinned# -> PinnedStatus #

compatMkWeak# :: o -> b -> IO () -> State# RealWorld -> (# State# RealWorld, Weak# b #) #

A mkWeak# version that keep working on 8.0

signature change in ghc-prim: * 0.4: mkWeak# :: o -> b -> c -> State# RealWorld -> ( RealWorld, Weak# b#) * 0.5 :mkWeak# :: o -> b -> (State# RealWorld -> ( RealWorld, c#)) -> State# RealWorld -> ( RealWorld, Weak# b#)

compatIsByteArrayPinned# :: ByteArray# -> Pinned# #

compatIsMutableByteArrayPinned# :: MutableByteArray# s -> Pinned# #

unsafeCoerce# :: a -> b #

Highly, terribly dangerous coercion from one representation type to another. Misuse of this function can invite the garbage collector to trounce upon your data and then laugh in your face. You don't want this function. Really.

data Word #

A `Word` is an unsigned integral type, with the same size as `Int`.

Constructors

W# Word# |

#### Instances

Instances details

PrintfArg Word | Since: base-2.1
Instance details Defined in Text.Printf Methods formatArg :: Word -> FieldFormatter # parseFormat :: Word -> ModifierParser #
BitOps Word # |
Instance details Defined in Basement.Bits Methods (.&.) :: Word -> Word -> Word # (.|.) :: Word -> Word -> Word # (.^.) :: Word -> Word -> Word # (.<<.) :: Word -> CountOf Bool -> Word # (.>>.) :: Word -> CountOf Bool -> Word # bit :: Offset Bool -> Word # isBitSet :: Word -> Offset Bool -> Bool # setBit :: Word -> Offset Bool -> Word # clearBit :: Word -> Offset Bool -> Word #
FiniteBitsOps Word # |
Instance details Defined in Basement.Bits Methods numberOfBits :: Word -> CountOf Bool # rotateL :: Word -> CountOf Bool -> Word # rotateR :: Word -> CountOf Bool -> Word # popCount :: Word -> CountOf Bool # bitFlip :: Word -> Word # countLeadingZeros :: Word -> CountOf Bool # countTrailingZeros :: Word -> CountOf Bool #
HasNegation Word # |
Instance details Defined in Basement.Compat.NumLiteral Methods negate :: Word -> Word #
Integral Word # |
Instance details Defined in Basement.Compat.NumLiteral Methods fromInteger :: Integer -> Word #
NormalForm Word # |
Instance details Defined in Basement.NormalForm Methods toNormalForm :: Word -> () #
Additive Word # |
Instance details Defined in Basement.Numerical.Additive Methods azero :: Word # (+) :: Word -> Word -> Word # scale :: IsNatural n => n -> Word -> Word #
IDivisible Word # |
Instance details Defined in Basement.Numerical.Multiplicative Methods div :: Word -> Word -> Word # mod :: Word -> Word -> Word # divMod :: Word -> Word -> (Word, Word) #
Multiplicative Word # |
Instance details Defined in Basement.Numerical.Multiplicative Methods midentity :: Word # (*) :: Word -> Word -> Word # (^) :: (IsNatural n, Enum n, IDivisible n) => Word -> n -> Word #
IsIntegral Word # |
Instance details Defined in Basement.Numerical.Number Methods toInteger :: Word -> Integer #
IsNatural Word # |
Instance details Defined in Basement.Numerical.Number Methods toNatural :: Word -> Natural #
Subtractive Word # |
Instance details Defined in Basement.Numerical.Subtractive Associated Types
type Difference Word |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word = Word
Methods (-) :: Word -> Word -> Difference Word #
PrimMemoryComparable Word # |
Instance details Defined in Basement.PrimType
PrimType Word # |
Instance details Defined in Basement.PrimType Associated Types
type PrimSize Word |
Instance details Defined in Basement.PrimType type PrimSize Word = 8
Methods primSizeInBytes :: Proxy Word -> CountOf Word8 # primShiftToBytes :: Proxy Word -> Int # primBaUIndex :: ByteArray# -> Offset Word -> Word # primMbaURead :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset Word -> prim Word # primMbaUWrite :: PrimMonad prim => MutableByteArray# (PrimState prim) -> Offset Word -> Word -> prim () # primAddrIndex :: Addr# -> Offset Word -> Word # primAddrRead :: PrimMonad prim => Addr# -> Offset Word -> prim Word # primAddrWrite :: PrimMonad prim => Addr# -> Offset Word -> Word -> prim () #
Bits Word | @since base-2.01
Instance details Defined in GHC.Internal.Bits Methods (.&.) :: Word -> Word -> Word # (.|.) :: Word -> Word -> Word # xor :: Word -> Word -> Word # complement :: Word -> Word # shift :: Word -> Int -> Word # rotate :: Word -> Int -> Word # zeroBits :: Word # bit :: Int -> Word # setBit :: Word -> Int -> Word # clearBit :: Word -> Int -> Word # complementBit :: Word -> Int -> Word # testBit :: Word -> Int -> Bool # bitSizeMaybe :: Word -> Maybe Int # bitSize :: Word -> Int # isSigned :: Word -> Bool # shiftL :: Word -> Int -> Word # unsafeShiftL :: Word -> Int -> Word # shiftR :: Word -> Int -> Word # unsafeShiftR :: Word -> Int -> Word # rotateL :: Word -> Int -> Word # rotateR :: Word -> Int -> Word # popCount :: Word -> Int #
FiniteBits Word | @since base-4.6.0.0
Instance details Defined in GHC.Internal.Bits Methods finiteBitSize :: Word -> Int # countLeadingZeros :: Word -> Int # countTrailingZeros :: Word -> Int #
Data Word | @since base-4.0.0.0
Instance details Defined in GHC.Internal.Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word -> c Word # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word # toConstr :: Word -> Constr # dataTypeOf :: Word -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word) # gmapT :: (forall b. Data b => b -> b) -> Word -> Word # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r # gmapQ :: (forall d. Data d => d -> u) -> Word -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word #
Bounded Word | @since base-2.01
Instance details Defined in GHC.Internal.Enum Methods minBound :: Word # maxBound :: Word #
Enum Word | @since base-2.01
Instance details Defined in GHC.Internal.Enum Methods succ :: Word -> Word # pred :: Word -> Word # toEnum :: Int -> Word # fromEnum :: Word -> Int # enumFrom :: Word -> [Word] # enumFromThen :: Word -> Word -> [Word] # enumFromTo :: Word -> Word -> [Word] # enumFromThenTo :: Word -> Word -> Word -> [Word] #
Storable Word | @since base-2.01
Instance details Defined in GHC.Internal.Foreign.Storable Methods sizeOf :: Word -> Int # alignment :: Word -> Int # peekElemOff :: Ptr Word -> Int -> IO Word # pokeElemOff :: Ptr Word -> Int -> Word -> IO () # peekByteOff :: Ptr b -> Int -> IO Word # pokeByteOff :: Ptr b -> Int -> Word -> IO () # peek :: Ptr Word -> IO Word # poke :: Ptr Word -> Word -> IO () #
Num Word | @since base-2.01
Instance details Defined in GHC.Internal.Num Methods (+) :: Word -> Word -> Word # (-) :: Word -> Word -> Word # (*) :: Word -> Word -> Word # negate :: Word -> Word # abs :: Word -> Word # signum :: Word -> Word # fromInteger :: Integer -> Word #
Read Word | @since base-4.5.0.0
Instance details Defined in GHC.Internal.Read Methods readsPrec :: Int -> ReadS Word # readList :: ReadS [Word] # readPrec :: ReadPrec Word # readListPrec :: ReadPrec [Word] #
Integral Word | @since base-2.01
Instance details Defined in GHC.Internal.Real Methods quot :: Word -> Word -> Word # rem :: Word -> Word -> Word # div :: Word -> Word -> Word # mod :: Word -> Word -> Word # quotRem :: Word -> Word -> (Word, Word) # divMod :: Word -> Word -> (Word, Word) # toInteger :: Word -> Integer #
Real Word | @since base-2.01
Instance details Defined in GHC.Internal.Real Methods toRational :: Word -> Rational #
Show Word | @since base-2.01
Instance details Defined in GHC.Internal.Show Methods showsPrec :: Int -> Word -> ShowS # show :: Word -> String # showList :: [Word] -> ShowS #
Eq Word |
Instance details Defined in GHC.Classes Methods (==) :: Word -> Word -> Bool # (/=) :: Word -> Word -> Bool #
Ord Word |
Instance details Defined in GHC.Classes Methods compare :: Word -> Word -> Ordering # (<) :: Word -> Word -> Bool # (<=) :: Word -> Word -> Bool # (>) :: Word -> Word -> Bool # (>=) :: Word -> Word -> Bool # max :: Word -> Word -> Word # min :: Word -> Word -> Word #
Cast Int64 Word # |
Instance details Defined in Basement.Cast Methods cast :: Int64 -> Word #
Cast Word64 Word # |
Instance details Defined in Basement.Cast Methods cast :: Word64 -> Word #
Cast Int Word # |
Instance details Defined in Basement.Cast Methods cast :: Int -> Word #
Cast Word Int64 # |
Instance details Defined in Basement.Cast Methods cast :: Word -> Int64 #
Cast Word Word64 # |
Instance details Defined in Basement.Cast Methods cast :: Word -> Word64 #
Cast Word Int # |
Instance details Defined in Basement.Cast Methods cast :: Word -> Int #
From Word16 Word # |
Instance details Defined in Basement.From Methods from :: Word16 -> Word #
From Word32 Word # |
Instance details Defined in Basement.From Methods from :: Word32 -> Word #
From Word8 Word # |
Instance details Defined in Basement.From Methods from :: Word8 -> Word #
From Word Word64 # |
Instance details Defined in Basement.From Methods from :: Word -> Word64 #
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 #
IntegralUpsize Word16 Word # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word16 -> Word #
IntegralUpsize Word32 Word # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word32 -> Word #
IntegralUpsize Word8 Word # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word8 -> Word #
IntegralUpsize Word Word64 # |
Instance details Defined in Basement.IntegralConv Methods integralUpsize :: Word -> Word64 #
From Word (CountOf ty) # |
Instance details Defined in Basement.From Methods from :: Word -> CountOf ty #
From Word (Offset ty) # |
Instance details Defined in Basement.From Methods from :: Word -> Offset ty #
Generic1 (URec Word :: k -> Type) |
Instance details Defined in GHC.Internal.Generics Associated Types
type Rep1 (URec Word :: k -> Type) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics type Rep1 (URec Word :: k -> Type) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UWord" 'PrefixI 'True) (S1 ('MetaSel ('Just "uWord#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UWord :: k -> Type)))
Methods from1 :: forall (a :: k). URec Word a -> Rep1 (URec Word :: k -> Type) a # to1 :: forall (a :: k). Rep1 (URec Word :: k -> Type) a -> URec Word a #
Foldable (UWord :: Type -> Type) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Foldable Methods fold :: Monoid m => UWord m -> m # foldMap :: Monoid m => (a -> m) -> UWord a -> m # foldMap' :: Monoid m => (a -> m) -> UWord a -> m # foldr :: (a -> b -> b) -> b -> UWord a -> b # foldr' :: (a -> b -> b) -> b -> UWord a -> b # foldl :: (b -> a -> b) -> b -> UWord a -> b # foldl' :: (b -> a -> b) -> b -> UWord a -> b # foldr1 :: (a -> a -> a) -> UWord a -> a # foldl1 :: (a -> a -> a) -> UWord a -> a # toList :: UWord a -> [a] # null :: UWord a -> Bool # length :: UWord a -> Int # elem :: Eq a => a -> UWord a -> Bool # maximum :: Ord a => UWord a -> a # minimum :: Ord a => UWord a -> a # sum :: Num a => UWord a -> a # product :: Num a => UWord a -> a #
Traversable (UWord :: Type -> Type) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> UWord a -> f (UWord b) # sequenceA :: Applicative f => UWord (f a) -> f (UWord a) # mapM :: Monad m => (a -> m b) -> UWord a -> m (UWord b) # sequence :: Monad m => UWord (m a) -> m (UWord a) #
From (CountOf ty) Word # |
Instance details Defined in Basement.From Methods from :: CountOf ty -> Word #
Functor (URec Word :: Type -> Type) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics Methods fmap :: (a -> b) -> URec Word a -> URec Word b # (<$) :: a -> URec Word b -> URec Word a #
Generic (URec Word p) |
Instance details Defined in GHC.Internal.Generics Associated Types
type Rep (URec Word p) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics type Rep (URec Word p) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UWord" 'PrefixI 'True) (S1 ('MetaSel ('Just "uWord#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UWord :: Type -> Type)))
Methods from :: URec Word p -> Rep (URec Word p) x # to :: Rep (URec Word p) x -> URec Word p #
Show (URec Word p) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics Methods showsPrec :: Int -> URec Word p -> ShowS # show :: URec Word p -> String # showList :: [URec Word p] -> ShowS #
Eq (URec Word p) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics Methods (==) :: URec Word p -> URec Word p -> Bool # (/=) :: URec Word p -> URec Word p -> Bool #
Ord (URec Word p) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics Methods compare :: URec Word p -> URec Word p -> Ordering # (<) :: URec Word p -> URec Word p -> Bool # (<=) :: URec Word p -> URec Word p -> Bool # (>) :: URec Word p -> URec Word p -> Bool # (>=) :: URec Word p -> URec Word p -> Bool # max :: URec Word p -> URec Word p -> URec Word p # min :: URec Word p -> URec Word p -> URec Word p #
type NatNumMaxBound Word # |
Instance details Defined in Basement.Nat type NatNumMaxBound Word = NatNumMaxBound Word64
type Difference Word # |
Instance details Defined in Basement.Numerical.Subtractive type Difference Word = Word
type PrimSize Word # |
Instance details Defined in Basement.PrimType type PrimSize Word = 8
data URec Word (p :: k) | Used for marking occurrences of `Word#` @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics data URec Word (p :: k) = UWord { uWord# :: Word# }
type Rep1 (URec Word :: k -> Type) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics type Rep1 (URec Word :: k -> Type) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UWord" 'PrefixI 'True) (S1 ('MetaSel ('Just "uWord#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UWord :: k -> Type)))
type Rep (URec Word p) | @since base-4.9.0.0
Instance details Defined in GHC.Internal.Generics type Rep (URec Word p) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UWord" 'PrefixI 'True) (S1 ('MetaSel ('Just "uWord#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (UWord :: Type -> Type)))

data Word8# :: TYPE 'Word8Rep #

data Word16# :: TYPE 'Word16Rep #

data Word32# :: TYPE 'Word32Rep #

data Int8# :: TYPE 'Int8Rep #

data Int16# :: TYPE 'Int16Rep #

data Int32# :: TYPE 'Int32Rep #

word8ToWord16# :: Word8# -> Word16# #

word8ToWord32# :: Word8# -> Word32# #

word8ToWord# :: Word8# -> Word# #

word16ToWord8# :: Word16# -> Word8# #

word16ToWord32# :: Word16# -> Word32# #

word16ToWord# :: Word16# -> Word# #

word32ToWord# :: Word32# -> Word# #

word32ToWord8# :: Word32# -> Word8# #

word32ToWord16# :: Word32# -> Word16# #

wordToWord32# :: Word# -> Word32# #

wordToWord16# :: Word# -> Word16# #

wordToWord8# :: Word# -> Word8# #

int8ToInt16# :: Int8# -> Int16# #

int8ToInt32# :: Int8# -> Int32# #

int8ToInt# :: Int8# -> Int# #

int16ToInt32# :: Int16# -> Int32# #

int16ToInt# :: Int16# -> Int# #

int32ToInt# :: Int32# -> Int# #

intToInt8# :: Int# -> Int8# #

intToInt16# :: Int# -> Int16# #

intToInt32# :: Int# -> Int32# #

word8ToInt# :: Word8# -> Int# #

word8ToInt16# :: Word8# -> Int16# #

word8ToInt32# :: Word8# -> Int32# #

charToWord32# :: Char# -> Word32# #

word8ToChar# :: Word8# -> Char# #

word16ToChar# :: Word16# -> Char# #

word32ToChar# :: Word32# -> Char# #

wordToChar# :: Word# -> Char# #

plusWord8# :: Word8# -> Word8# -> Word8# #

uncheckedShiftRLWord16# :: Word16# -> Int# -> Word16# #

plusWord16# :: Word16# -> Word16# -> Word16# #

uncheckedShiftRLWord32# :: Word32# -> Int# -> Word32# #

plusWord32# :: Word32# -> Word32# -> Word32# #

plusInt8# :: Int8# -> Int8# -> Int8# #

plusInt16# :: Int16# -> Int16# -> Int16# #

plusInt32# :: Int32# -> Int32# -> Int32# #