primal-0.3.0.0: Primeval world of Haskell.
Copyright(c) Alexey Kuleshevich 2020
LicenseBSD3
MaintainerAlexey Kuleshevich <alexey@kuleshevi.ch>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Prim.Class

Description

 
Synopsis

Documentation

class Prim a where Source #

Invariants:

  • Reading should never fail on memory that contains only zeros
  • Writing should always overwrite all of the bytes allocated for the element. In other words, writing to a dirty (uninitilized) region of memory should never leave any garbage around. For example, if a type requires 31 bytes of memory then on any write all 31 bytes must be overwritten.
  • A single thread write/read sequence must always roundtrip
  • This is not a class for serialization, therefore memory layout of unpacked datatype is selfcontained in Prim class and representation is not expected to stay the same between different versions of software. Primitive types like Int, Word, Char are an exception to this rule for obvious reasons.

Minimal complete definition

Nothing

Associated Types

type PrimBase a :: * Source #

type SizeOf a :: Nat Source #

type SizeOf a = SizeOf (PrimBase a)

type Alignment a :: Nat Source #

Methods

toPrimBase :: a -> PrimBase a Source #

default toPrimBase :: Coercible a (PrimBase a) => a -> PrimBase a Source #

fromPrimBase :: PrimBase a -> a Source #

default fromPrimBase :: Coercible a (PrimBase a) => PrimBase a -> a Source #

sizeOf# :: Proxy# a -> Int# Source #

Returned value must match the SizeOf type level Nat

default sizeOf# :: Prim (PrimBase a) => Proxy# a -> Int# Source #

alignment# :: Proxy# a -> Int# Source #

Returned value must match the Alignment type level Nat

default alignment# :: Prim (PrimBase a) => Proxy# a -> Int# Source #

indexByteOffByteArray# :: ByteArray# -> Int# -> a Source #

indexByteArray# :: ByteArray# -> Int# -> a Source #

default indexByteArray# :: Prim (PrimBase a) => ByteArray# -> Int# -> a Source #

indexOffAddr# :: Addr# -> Int# -> a Source #

default indexOffAddr# :: Prim (PrimBase a) => Addr# -> Int# -> a Source #

readByteOffMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) Source #

readMutableByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) Source #

default readMutableByteArray# :: Prim (PrimBase a) => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) Source #

readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, a #) Source #

default readOffAddr# :: Prim (PrimBase a) => Addr# -> Int# -> State# s -> (# State# s, a #) Source #

writeByteOffMutableByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s Source #

writeMutableByteArray# :: MutableByteArray# s -> Int# -> a -> State# s -> State# s Source #

writeOffAddr# :: Addr# -> Int# -> a -> State# s -> State# s Source #

default writeOffAddr# :: Prim (PrimBase a) => Addr# -> Int# -> a -> State# s -> State# s Source #

setMutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s Source #

Set the region of MutableByteArray to the same value. Offset is in number of elements

setOffAddr# :: Addr# -> Int# -> Int# -> a -> State# s -> State# s Source #

Set the region of memory to the same value. Offset is in number of elements

default setOffAddr# :: Prim (PrimBase a) => Addr# -> Int# -> Int# -> a -> State# s -> State# s Source #

Instances

Instances details
Prim Bool Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Bool Source #

type SizeOf Bool :: Nat Source #

type Alignment Bool :: Nat Source #

Prim Char Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Char Source #

type SizeOf Char :: Nat Source #

type Alignment Char :: Nat Source #

Prim Double Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Double Source #

type SizeOf Double :: Nat Source #

type Alignment Double :: Nat Source #

Prim Float Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Float Source #

type SizeOf Float :: Nat Source #

type Alignment Float :: Nat Source #

Prim Int Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Int Source #

type SizeOf Int :: Nat Source #

type Alignment Int :: Nat Source #

Prim Int8 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Int8 Source #

type SizeOf Int8 :: Nat Source #

type Alignment Int8 :: Nat Source #

Prim Int16 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Int16 Source #

type SizeOf Int16 :: Nat Source #

type Alignment Int16 :: Nat Source #

Prim Int32 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Int32 Source #

type SizeOf Int32 :: Nat Source #

type Alignment Int32 :: Nat Source #

Prim Int64 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Int64 Source #

type SizeOf Int64 :: Nat Source #

type Alignment Int64 :: Nat Source #

Prim Ordering Source # 
Instance details

Defined in Data.Prim.Class

Prim Word Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Word Source #

type SizeOf Word :: Nat Source #

type Alignment Word :: Nat Source #

Prim Word8 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Word8 Source #

type SizeOf Word8 :: Nat Source #

type Alignment Word8 :: Nat Source #

Prim Word16 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Word16 Source #

type SizeOf Word16 :: Nat Source #

type Alignment Word16 :: Nat Source #

Prim Word32 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Word32 Source #

type SizeOf Word32 :: Nat Source #

type Alignment Word32 :: Nat Source #

Prim Word64 Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Word64 Source #

type SizeOf Word64 :: Nat Source #

type Alignment Word64 :: Nat Source #

Prim () Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase () Source #

type SizeOf () :: Nat Source #

type Alignment () :: Nat Source #

Prim BlockReason Source # 
Instance details

Defined in Data.Prim.Class

Prim ThreadStatus Source # 
Instance details

Defined in Data.Prim.Class

Prim CDev Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CDev Source #

type SizeOf CDev :: Nat Source #

type Alignment CDev :: Nat Source #

Prim CIno Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CIno Source #

type SizeOf CIno :: Nat Source #

type Alignment CIno :: Nat Source #

Prim CMode Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CMode Source #

type SizeOf CMode :: Nat Source #

type Alignment CMode :: Nat Source #

Prim COff Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase COff Source #

type SizeOf COff :: Nat Source #

type Alignment COff :: Nat Source #

Prim CPid Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CPid Source #

type SizeOf CPid :: Nat Source #

type Alignment CPid :: Nat Source #

Prim CSsize Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CSsize Source #

type SizeOf CSsize :: Nat Source #

type Alignment CSsize :: Nat Source #

Prim CGid Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CGid Source #

type SizeOf CGid :: Nat Source #

type Alignment CGid :: Nat Source #

Prim CNlink Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CNlink Source #

type SizeOf CNlink :: Nat Source #

type Alignment CNlink :: Nat Source #

Prim CUid Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CUid Source #

type SizeOf CUid :: Nat Source #

type Alignment CUid :: Nat Source #

Prim CCc Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CCc Source #

type SizeOf CCc :: Nat Source #

type Alignment CCc :: Nat Source #

Prim CSpeed Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CSpeed Source #

type SizeOf CSpeed :: Nat Source #

type Alignment CSpeed :: Nat Source #

Prim CTcflag Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CTcflag Source #

type SizeOf CTcflag :: Nat Source #

type Alignment CTcflag :: Nat Source #

Prim CRLim Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CRLim Source #

type SizeOf CRLim :: Nat Source #

type Alignment CRLim :: Nat Source #

Prim CBlkSize Source # 
Instance details

Defined in Data.Prim.Class

Prim CBlkCnt Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CBlkCnt Source #

type SizeOf CBlkCnt :: Nat Source #

type Alignment CBlkCnt :: Nat Source #

Prim CClockId Source # 
Instance details

Defined in Data.Prim.Class

Prim CFsBlkCnt Source # 
Instance details

Defined in Data.Prim.Class

Prim CFsFilCnt Source # 
Instance details

Defined in Data.Prim.Class

Prim CId Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CId Source #

type SizeOf CId :: Nat Source #

type Alignment CId :: Nat Source #

Prim CKey Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CKey Source #

type SizeOf CKey :: Nat Source #

type Alignment CKey :: Nat Source #

Prim CTimer Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CTimer Source #

type SizeOf CTimer :: Nat Source #

type Alignment CTimer :: Nat Source #

Prim CSocklen Source # 
Instance details

Defined in Data.Prim.Class

Prim CNfds Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CNfds Source #

type SizeOf CNfds :: Nat Source #

type Alignment CNfds :: Nat Source #

Prim Fd Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Fd Source #

type SizeOf Fd :: Nat Source #

type Alignment Fd :: Nat Source #

Prim Errno Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Errno Source #

type SizeOf Errno :: Nat Source #

type Alignment Errno :: Nat Source #

Prim BufferMode Source # 
Instance details

Defined in Data.Prim.Class

Prim Newline Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Newline Source #

type SizeOf Newline :: Nat Source #

type Alignment Newline :: Nat Source #

Prim NewlineMode Source # 
Instance details

Defined in Data.Prim.Class

Prim IODeviceType Source # 
Instance details

Defined in Data.Prim.Class

Prim SeekMode Source # 
Instance details

Defined in Data.Prim.Class

Prim All Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase All Source #

type SizeOf All :: Nat Source #

type Alignment All :: Nat Source #

Prim Any Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase Any Source #

type SizeOf Any :: Nat Source #

type Alignment Any :: Nat Source #

Prim CChar Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CChar Source #

type SizeOf CChar :: Nat Source #

type Alignment CChar :: Nat Source #

Prim CSChar Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CSChar Source #

type SizeOf CSChar :: Nat Source #

type Alignment CSChar :: Nat Source #

Prim CUChar Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CUChar Source #

type SizeOf CUChar :: Nat Source #

type Alignment CUChar :: Nat Source #

Prim CShort Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CShort Source #

type SizeOf CShort :: Nat Source #

type Alignment CShort :: Nat Source #

Prim CUShort Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CUShort Source #

type SizeOf CUShort :: Nat Source #

type Alignment CUShort :: Nat Source #

Prim CInt Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CInt Source #

type SizeOf CInt :: Nat Source #

type Alignment CInt :: Nat Source #

Prim CUInt Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CUInt Source #

type SizeOf CUInt :: Nat Source #

type Alignment CUInt :: Nat Source #

Prim CLong Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CLong Source #

type SizeOf CLong :: Nat Source #

type Alignment CLong :: Nat Source #

Prim CULong Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CULong Source #

type SizeOf CULong :: Nat Source #

type Alignment CULong :: Nat Source #

Prim CLLong Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CLLong Source #

type SizeOf CLLong :: Nat Source #

type Alignment CLLong :: Nat Source #

Prim CULLong Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CULLong Source #

type SizeOf CULLong :: Nat Source #

type Alignment CULLong :: Nat Source #

Prim CBool Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CBool Source #

type SizeOf CBool :: Nat Source #

type Alignment CBool :: Nat Source #

Prim CFloat Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CFloat Source #

type SizeOf CFloat :: Nat Source #

type Alignment CFloat :: Nat Source #

Prim CDouble Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CDouble Source #

type SizeOf CDouble :: Nat Source #

type Alignment CDouble :: Nat Source #

Prim CPtrdiff Source # 
Instance details

Defined in Data.Prim.Class

Prim CSize Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CSize Source #

type SizeOf CSize :: Nat Source #

type Alignment CSize :: Nat Source #

Prim CWchar Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CWchar Source #

type SizeOf CWchar :: Nat Source #

type Alignment CWchar :: Nat Source #

Prim CSigAtomic Source # 
Instance details

Defined in Data.Prim.Class

Prim CIntPtr Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CIntPtr Source #

type SizeOf CIntPtr :: Nat Source #

type Alignment CIntPtr :: Nat Source #

Prim CUIntPtr Source # 
Instance details

Defined in Data.Prim.Class

Prim CIntMax Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase CIntMax Source #

type SizeOf CIntMax :: Nat Source #

type Alignment CIntMax :: Nat Source #

Prim CUIntMax Source # 
Instance details

Defined in Data.Prim.Class

Prim WordPtr Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase WordPtr Source #

type SizeOf WordPtr :: Nat Source #

type Alignment WordPtr :: Nat Source #

Prim IntPtr Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase IntPtr Source #

type SizeOf IntPtr :: Nat Source #

type Alignment IntPtr :: Nat Source #

Prim IOMode Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase IOMode Source #

type SizeOf IOMode :: Nat Source #

type Alignment IOMode :: Nat Source #

Prim Fingerprint Source # 
Instance details

Defined in Data.Prim.Class

Prim GeneralCategory Source # 
Instance details

Defined in Data.Prim.Class

Prim Size Source # 
Instance details

Defined in Data.Prim.Array

Associated Types

type PrimBase Size Source #

type SizeOf Size :: Nat Source #

type Alignment Size :: Nat Source #

Prim a => Prim (Maybe a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Maybe a) Source #

type SizeOf (Maybe a) :: Nat Source #

type Alignment (Maybe a) :: Nat Source #

Prim a => Prim (Ratio a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Ratio a) Source #

type SizeOf (Ratio a) :: Nat Source #

type Alignment (Ratio a) :: Nat Source #

Prim (StablePtr a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (StablePtr a) Source #

type SizeOf (StablePtr a) :: Nat Source #

type Alignment (StablePtr a) :: Nat Source #

Prim (Ptr a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Ptr a) Source #

type SizeOf (Ptr a) :: Nat Source #

type Alignment (Ptr a) :: Nat Source #

Prim (FunPtr a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (FunPtr a) Source #

type SizeOf (FunPtr a) :: Nat Source #

type Alignment (FunPtr a) :: Nat Source #

Prim a => Prim (Complex a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Complex a) Source #

type SizeOf (Complex a) :: Nat Source #

type Alignment (Complex a) :: Nat Source #

Prim a => Prim (Min a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Min a) Source #

type SizeOf (Min a) :: Nat Source #

type Alignment (Min a) :: Nat Source #

Prim a => Prim (Max a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Max a) Source #

type SizeOf (Max a) :: Nat Source #

type Alignment (Max a) :: Nat Source #

Prim a => Prim (First a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (First a) Source #

type SizeOf (First a) :: Nat Source #

type Alignment (First a) :: Nat Source #

Prim a => Prim (Last a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Last a) Source #

type SizeOf (Last a) :: Nat Source #

type Alignment (Last a) :: Nat Source #

Prim a => Prim (Identity a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Identity a) Source #

type SizeOf (Identity a) :: Nat Source #

type Alignment (Identity a) :: Nat Source #

Prim a => Prim (Dual a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Dual a) Source #

type SizeOf (Dual a) :: Nat Source #

type Alignment (Dual a) :: Nat Source #

Prim a => Prim (Sum a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Sum a) Source #

type SizeOf (Sum a) :: Nat Source #

type Alignment (Sum a) :: Nat Source #

Prim a => Prim (Product a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Product a) Source #

type SizeOf (Product a) :: Nat Source #

type Alignment (Product a) :: Nat Source #

Prim a => Prim (Down a) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Down a) Source #

type SizeOf (Down a) :: Nat Source #

type Alignment (Down a) :: Nat Source #

Prim a => Prim (Atom a) Source # 
Instance details

Defined in Data.Prim.Atom

Associated Types

type PrimBase (Atom a) Source #

type SizeOf (Atom a) :: Nat Source #

type Alignment (Atom a) :: Nat Source #

Prim (Off e) Source # 
Instance details

Defined in Data.Prim

Associated Types

type PrimBase (Off e) Source #

type SizeOf (Off e) :: Nat Source #

type Alignment (Off e) :: Nat Source #

Prim (Count e) Source # 
Instance details

Defined in Data.Prim

Associated Types

type PrimBase (Count e) Source #

type SizeOf (Count e) :: Nat Source #

type Alignment (Count e) :: Nat Source #

(Prim a, Prim b) => Prim (Either a b) Source # 
Instance details

Defined in Data.Prim.Class

Associated Types

type PrimBase (Either a b) Source #

type SizeOf (Either a b) :: Nat Source #

type Alignment (Either a b) :: Nat Source #