h$      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                            (c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/?  primal-memoryMutable region of memory which was allocated either as pinned or unpinned.=Constructor is not exported for safety. Violating type level 0 kind is very dangerous. Type safe constructor   and unwrapper   should be used instead. As a backdoor, of course, the actual constructor is available in Data.Prim.Memory.Internal' module and specially unsafe function  was crafted. primal-memoryAn immutable region of memory which was allocated either as pinned or unpinned.=Constructor is not exported for safety. Violating type level 0 kind is very dangerous. Type safe constructor   and unwrapper  should be used instead. As a backdoor, of course, the actual constructor is available from Data.Prim.Memory.Internal primal-memoryIn GHC there is a distinction between pinned and unpinned memory.Pinned memory is such that when allocated, it is guaranteed not to move throughout the lifetime of a program. In other words the address pointer that refers to allocated bytes will not change until the associated  or  is no longer referenced anywhere in the program at which point it gets garbage collected. On the other hand unpinned memory can be moved around during GC, which helps to reduce memory fragmentation.Pinned/unpinnned choice during allocation is a bit of a lie, because when attempt is made to allocate memory as unpinned, but requested size is a bit more than a certain threshold (somewhere around 3KiB) it might still be allocated as pinned. Because of that fact through out the "primal" universe there is a distinction between memory that is either ned or  onclusive.It is possible to use one of  or  to get a conclusive type. primal-memory;Pinned, which indicates that allocated memory will not move primal-memory5Inconclusive, thus memory could be pinned or unpinned primal-memoryUnwrap  to get the underlying . primal-memoryWrap  into  primal-memoryUnwrap  to get the underlying . primal-memoryWrap  into - primal-memoryShrink mutable bytes to new specified count of elements. The new count must be less than or equal to the current count as reported by 5.. primal-memory)Attempt to resize mutable bytes in place.:New bytes might be allocated, with the copy of an old one.Old references should not be kept around to allow GC to claim it=Old references should not be used to avoid undefined behavior4 primal-memoryHow many elements of type a fits into bytes completely. In order to get a possible count of leftover bytes use  countRemBytes5 primal-memoryHow many elements of type a fits into bytes completely. In order to get any number of leftover bytes use  countRemBytes= primal-memoryO(1) - Cast an unboxed array into > primal-memoryO(1) - Cast  into an unboxed array? primal-memoryO(1)% - Cast a mutable unboxed array into @ primal-memoryO(1) - Cast  into a mutable unboxed arrayC primal-memoryPointer access to immutable  should be for read only purposes, but it is not enforced. Any mutation will break referential transparencyD primal-memorySame as C2, but is suitable for actions that don't terminate primal-memoryThis function will only cast a pointer that was allocated on Haskell heap and it is cerain that the ForeignPtr has no finalizers associated with it.I primal-memoryCheck if two byte arrays refer to pinned memory and compare their pointers.J primal-memory#Perform pointer equality on pinned .K primal-memory?@ABCDEFGHIJKL(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/>?MNOPQRSTUVWX MSOQUNTPRVWX(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/fY primal-memoryMutable version of a  [ primal-memoryO(1) - Cast immutable  to an immutable  \ primal-memoryO(1) - Cast an immutable  to an immutable  ] primal-memoryO(1) - Cast an immutable   to an immutable ^ primal-memoryConvert  into a bytestring  _ primal-memoryO(n) - Allocate " and fill them using the supplied  ` primal-memoryO(n) - Allocate + and fill them with the contents of a lazy a primal-memoryO(n) - Convert a strict   to .  LYZ[\]^_`abcYZ ^_ [a`bc \]L(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone />?. d primal-memoryFor memory allocated as pinned it is possible to operate on it with a :. Any data type that is backed by such memory can have a d3 instance. The simplest way is to convert it to a ( and other functions will come for free.e primal-memory Convert to .f primal-memory"Apply an action to the raw memory  to which the data type point to. Type of data stored in memory is left ambiguous intentionaly, so that the user can choose how to treat the memory content.g primal-memory See this GHC  /https://gitlab.haskell.org/ghc/ghc/issues/17746 issue #17746 and related to it in order to get more insight why this is needed.h primal-memoryApply an action to the raw pointer. It is unsafe to return the actual pointer back from the action because memory itself might get garbage collected or cleaned up by finalizers.It is also important not to run non-terminating actions, because GHC can optimize away the logic that runs after the action and GC will happen before the action get's a chance to finish resulting in corrupt memory. Whenever you have an action that runs an infinite loop or ends in an exception throwing, make sure to use i instead.i primal-memorySame thing as h9 except it should be used for never ending actions. See g0 for more information on how this differes from h.j primal-memoryLifted version of .k primal-memoryLifted version of .l primal-memoryLifted version of .m primal-memoryLifted version of .n primal-memory Simila to , except it operates on  , instead of Storable.o primal-memory Similar to , except instead of Storable we use .p primal-memory Just like o*, but memory is also aligned according to  instanceq primal-memoryLifted version of .r primal-memoryLifted version of .s primal-memoryLifted version of t primal-memoryLifted version of u primal-memory Similar to , except instead of Storable we use  and we are not restricted to ), since finalizers are not possible with  PlaintPtrv primal-memory Similar to , except instead of Storable we use .w primal-memory Just like o*, but memory is also aligned according to  instancex primal-memoryLifted version of .y primal-memoryLifted version of .z primal-memoryUnlifted version of { primal-memoryUnlifted version of | primal-memoryLifted version of .} primal-memoryAdvances the given address by the given offset in number of elemeents. This operation does not affect associated finalizers in any way.~ primal-memoryAdvances the given address by the given offset in bytes. This operation does not affect associated finalizers in any way. primal-memoryFind the offset in bytes that is between the two pointers by subtracting one address from another. primal-memoryFind the offset in number of elements that is between the two pointers by subtracting one address from another and dividing the result by the size of an element. primal-memorySame as , but will also return the remainder in bytes that is left over. primal-memory3Read-only access, but immutability is not enforced. primal-memory3Read-only access, but immutability is not enforced.r primal-memoryNumber of bytes to allocate primal-memoryAlignment in bytesy primal-memoryNumber of bytes to allocate primal-memoryAlignment in bytes* GHdefghijklmnopqrstuvwxyz{|}~*defg}~hiuvwxy|kmjnopqrs ltz{GH(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/19 primal-memoryMutable version of a  primal-memoryO(1) - Cast an immutable  from text package to immutable  primal-memoryO(1) - Cast immutable  to an immutable  from text package primal-memoryO(1) - Cast a mutable  from text package to mutable  primal-memoryO(1) - Cast mutable  to a mutable  from text package(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/>?  primal-memoryA wrapper that adds a phantom state token. It can be used with types that either don't have such state token or are designed to work in  and therefore restricted to . Using this wrapper is very much unsafe, so make sure you know what you are doing. primal-memoryGeneralized memory allocation and pure/mutable state conversion. primal-memoryMemory region in the immutable state. Types for frozen and thawed states of memory region are in one-to-one correspondence, therefore ma  - FrozeMem ma will always uniquely identify each other, which is an extremely useful property when it comes to type inference. primal-memoryExtract the number of bytes a mutable memory region can hold, i.e. what is the total allocated size for this region. The size of a region can be changes and in some circuimstances even in place without copy, see  for more info.Examples;m <- allocMutMem (10 :: Count Int64) :: IO (MBytes 'Pin RW)getByteCountMutMem mCount {unCount = 80} primal-memoryAllocate a mutable memory region for specified number of elements. Memory is not reset and will likely hold some garbage data, therefore prefer to use , unless it is guaranteed that all of allocated memory will be overwritten. UnsafeWhen any of preconditions for memCount argument is violated the outcome is unpredictable. One possible outcome is termination with  async exception. In a pure setting, such as when executed within , if allocated memory is not fully overwritten it can lead to violation of referential transparency, because contents of newly allocated region is non-determinstic. primal-memoryConvert the state of an immutable memory region to the mutable one. This is a no copy operation, as such it is fast, but dangerous. See thawCloneMutMem for a safe alternative. UnsafeThis function makes it possible to break referential transparency, because any subsequent destructive operation to the mutable region of memory will also be reflected in the frozen immutable type as well. primal-memoryConvert the state of a mutable memory region to the immutable one. This is a no copy operation, as such it is fast, but dangerous. See  freezeCopyMem for a safe alternative. UnsafeIt makes it possible to break referential transparency, because any subsequent destructive operation to the mutable region of memory will also be reflected in the frozen immutable type as well. primal-memoryEither grow or shrink currently allocated mutable region of memory. For some implementations it might be possible to change the size of the allocated region in-place, i.e. without copy. However in all implementations there is a good chance that the memory region has to be allocated anew, in which case all of the contents up to the minimum of new and old sizes will get copied over. After the resize operation is complete the supplied  memSource region must not be used anymore. Moreover, no reference to the old one should be kept in order to allow garbage collection of the original in case a new one had to be allocated.Default implementation is  UnsafeUndefined behavior when  memSource4 is used afterwards. The same unsafety notice from  with regards to memCount is applicable here as well. primal-memoryType class that can be implemented for a mutable data type that provides direct read and write access to memory primal-memoryCheck if two mutable regions refer to the exact same region of memory primal-memoryRead an element with an offset in number of elements, rather than bytes as it is the case with . Unsafe.Bounds are not checked. When precondition for off argument is violated the result is either unpredictable output or failure with a segfault. primal-memory2Read an element with an offset in number of bytes. Unsafe.Bounds are not checked. When precondition for off argument is violated the result is either unpredictable output or failure with a segfault. primal-memoryWrite an element with an offset in number of elements, rather than bytes as it is the case with . Unsafe.Bounds are not checked. When precondition for off argument is violated the outcome is either heap corruption or failure with a segfault. primal-memory3Write an element with an offset in number of bytes. Unsafe.Bounds are not checked. When precondition for off argument is violated the outcome is either heap corruption or failure with a segfault. primal-memoryCopy contiguous chunk of memory from the source mutable memory into the target mutable . Source and target may% refer to overlapping memory regions. Unsafe-When any precondition for one of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSource., heap corruption or failure with a segfault. primal-memoryCopy contiguous chunk of memory from the source mutable memory into the target . Source and target may% refer to overlapping memory regions. Unsafe-When any precondition for one of the offsets  memSourceOff or  memTargetOff, a target pointer  memTarget or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSource-, heap corruption or failure with a segfault. primal-memoryCopy contiguous chunk of memory from the read only memory region into the target mutable memory region. Source and target must not refer to the same memory region, otherwise that would imply that the source is not immutable which would be a violation of some other invariant elsewhere in the code. Unsafe-When any precondition for one of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSourceRead., heap corruption or failure with a segfault. primal-memoryCopy contiguous chunk of memory from a mutable memory region into the target mutable memory region. Source and target may! refer to the same memory region. Unsafe-When any precondition for one of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSourceRead., heap corruption or failure with a segfault. primal-memoryWrite the same value memCount times into each cell of  memTarget starting at an offset  memTargetOff. Unsafe.Bounds are not checked. When precondition for  memTargetOff argument is violated the outcome is either heap corruption or failure with a segfault. primal-memoryType class that can be implemented for an immutable data type that provides read-only direct access to memory primal-memoryCheck if two read only regions refer to the exact same region of memory primal-memoryNumber of bytes allocated by the data type available for reading.Example:set -XDataKindsimport Data.Prim.Memory4byteCountMem (fromByteListMem [1,2,3] :: Bytes 'Inc)Count {unCount = 3} primal-memoryRead an element with an offset in number of elements, rather than bytes as is the case with . Unsafe.Bounds are not checked. When precondition for off argument is violated the result is either unpredictable output or failure with a segfault. primal-memoryRead an element with an offset in number of bytes. Bounds are not checked. UnsafeWhen precondition for off argument is violated the result is either unpredictable output or failure with a segfault. primal-memoryCopy contiguous chunk of memory from the read only memory into the target mutable . Source and target must not refer to the same memory region, otherwise that would imply that the source is not immutable which would be a violation of some other invariant elsewhere in the code. Unsafe.When a precondition for either of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memoryCopy contiguous chunk of memory from the read only memory into the target mutable . Source and target must not refer to the same memory region, otherwise that would imply that the source is not immutable which would be a violation of some other invariant elsewhere in the code. Unsafe-When any precondition for one of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSourceRead., heap corruption or failure with a segfault. primal-memorySame as , but compare the read-only memory region to a region addressed by a  inside of a . Unsafe0When any precondition for either of the offsets memOff1, memOff2, the pointer memRead2 or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memorySame as -, but compare the read-only memory region to . Unsafe0When any precondition for either of the offsets memOff1, memOff2 or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memoryCompare two read-only regions of memory byte-by-byte. The very first mismatched byte will cause this function to produce  if the byte in memRead1 is smaller than the one in memRead2 and  if it is bigger. It is not a requirement to short-circuit on the first mismatch, but it is a good optimization to have for non-sensitive data. Memory regions that store security critical data may choose to implement this function to work in constant time.6This function is usually implemented by either one of  or , depending on the nature of mr type. However it differs from the aforementioned functions with a fact that it is pure non-monadic computation. Unsafe0When any precondition for either of the offsets memOff1, memOff2 or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memory;An action that can be used as a default implementation for . Whenever current memory region byte count matches the supplied new size exactly then such memory region is simply returned back and this function is a noop. Otherwise a new memory region is allocated and all the data that can fit into the new region will be copied over. UnsafeSame unsafety notice as in  primal-memoryPlace n copies of supplied region of memory one after another in a newly allocated contiguous chunk of memory. Similar to , but the source memory memRead% does not have to match the type of  ma.Example:set -XTypeApplications:set -XDataKindsimport Data.Prim.Memorylet b = fromListMem @Word8 @(MBytes 'Inc) [0xde, 0xad, 0xbe, 0xef]cycleMemN @(MBytes 'Inc) 2 b)[0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef] primal-memoryConstruct an immutable memory region that can't hold any data. Same as  ::  maExample:set -XTypeApplications:set -XDataKindsimport Data.Prim.Memory,toListMem (emptyMem @(MBytes 'Inc)) :: [Int][] primal-memoryAllocate a region of immutable memory that holds a single element.Example:set -XTypeApplications:set -XDataKindsimport Data.Prim.MemorytoListMem (singletonMem @Word16 @(MBytes 'Inc) 0xffff) :: [Word8] [255,255] primal-memorySame as , but also use 2 to reset all of newly allocated memory to zeros. UnsafeWhen precondition for memCount argument is violated the outcome is unpredictable. One possible outcome is termination with  async exception.Example:set -XTypeApplications:set -XDataKindsimport Data.Prim.Memory,mb <- allocZeroMutMem @Int @(MBytes 'Inc) 10b <- freezeMutMem mbtoListMem b :: [Int][0,0,0,0,0,0,0,0,0,0] primal-memoryAllocate a mutable region of memory and fill it with the supplied  action. Besides the newly filled frozen memory this function also returns the result produced by the filling action. See - for the version that discards it. Also see  for a safer alternative. UnsafeSame caviats as in  primal-memorySame as , except it in ensures that the memory is reset to zeros right after allocation UnsafeSame caviats as in  : violation of precondition for memCount& may result in undefined behavior or  async exception. primal-memorySame as , except it ensures that the memory gets reset with zeros right after allocation and prior applying the ST filling action  fillAction. UnsafeSame reasons as  : violation of precondition for memCount& may result in undefined behavior or  async exception.ExampleNote that this example will work correctly only on little-endian machines::set -XTypeApplicationsimport Data.Primimport Control.Monadlet ibs = zip [0, 4 ..] [0x48,0x61,0x73,0x6b,0x65,0x6c,0x6c] :: [(Off Word8, Word8)](let c = Count (length ibs) :: Count Charlet bc = createZeroMemST_ @_ @(MBytes 'Inc) c $ \m -> forM_ ibs $ \(i, b) -> writeByteOffMutMem m i btoListMem bc :: String "Haskell" primal-memoryCopy all of the data from the source into a newly allocate memory region of identical size.Examples:set -XDataKindsimport Data.Prim.Memoryimport Data.Prim.Memory.Bytes=let xs = fromByteListMem @(MBytes 'Pin) [0..15] :: Bytes 'Pinlet ys = cloneMem xslet report bEq pEq = print $ "Bytes equal: " ++ show bEq ++ ", their pointers equal: " ++ show pEqwithPtrBytes xs $ \ xsPtr -> withPtrBytes ys $ \ ysPtr -> report (xs == ys) (xsPtr == ysPtr)0"Bytes equal: True, their pointers equal: False",report (eqByteMem xs ys) (isSameBytes xs ys)0"Bytes equal: True, their pointers equal: False" primal-memory Similar to , but supply offsets in number of elements instead of bytes. Copy contiguous chunk of memory from the read only memory region into the target mutable memory region. Source and target must not refer to the same memory region, otherwise that would imply that the source is not immutable which would be a violation of some other invariant elsewhere in the code. Unsafe-When any precondition for one of the offsets  memSourceOff,  memTargetOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSourceRead., heap corruption or failure with a segfault. primal-memoryThis is a safe version of . It first makes an exact copy of the supplied memory region and only then thaws it, thus yielding a mutable region of memory. This means any mutation, will only affect the newly allocated region that was returned and not the source region.Examples:set -XTypeApplications:set -XDataKindsimport Data.Prim.Memory4let fm = fromListMem @Word8 @(MBytes 'Inc) [1,2,3,4]mm <- thawCloneMem fm&writeOffMutMem mm 1 (0xadde :: Word16)freezeMutMem mm[0x01,0x02,0xde,0xad]fm[0x01,0x02,0x03,0x04] primal-memory Similar to , except it is possible to specify which portion of the frozen region will be copied over and thawed. Unsafe+When any precondition for eihter an offset  memSourceOff or the element count memCount is violated a call to this function can result in: copy of data that doesn't belong to  memSource or failure with a segfault.Examples:set -XTypeApplications:set -XDataKindsimport Data.Prim.Memory6let fm = fromListMem @Word8 @(MBytes 'Inc) [1,2,3,4,5])mm <- thawCopyMem fm 1 (3 :: Count Word8) writeOffMutMem mm 1 (0 :: Word8)freezeMutMem mm[0x02,0x00,0x04]fm[0x01,0x02,0x03,0x04,0x05] primal-memorySafe version of . Yields an immutable copy of the supplied mutable memory region. Further mutation of the source memory region will not affect the produced copy. primal-memoryO(n) - Convert a read-only memory region into a newly allocated other type of memory regionimport Data.ByteString (pack)let bs = pack [0x10 .. 0x20]bs>"\DLE\DC1\DC2\DC3\DC4\NAK\SYN\ETB\CAN\EM\SUB\ESC\FS\GS\RS\US "convertMem bs :: Bytes 'Inc[0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x20] primal-memoryFigure out how many elements fits into the immutable region of memory. It is possible that there is a remainder of bytes left, see  for getting that too.Examples3let b = fromListMem [0 .. 5 :: Word8] :: Bytes 'Pinb[0x00,0x01,0x02,0x03,0x04,0x05]countMem b :: Count Word16Count {unCount = 3}countMem b :: Count Word32Count {unCount = 1}countMem b :: Count Word64Count {unCount = 0} primal-memoryFigure out how many elements and a byte size remainder can fit into the immutable region of memory.Examples3let b = fromListMem [0 .. 5 :: Word8] :: Bytes 'Pinb[0x00,0x01,0x02,0x03,0x04,0x05]countRemMem @Word16 b)(Count {unCount = 3},Count {unCount = 0})countRemMem @Word32 b)(Count {unCount = 1},Count {unCount = 2})countRemMem @Word64 b)(Count {unCount = 0},Count {unCount = 6}) primal-memoryFigure out how many elements fits into the mutable region of memory. Similar to , except that it is not a pure funciton, since the size of mutable memory can change throuhout its lifetime. It is possible that there is a remainder of bytes left, see getCountRemMem for getting that too.Examples;mb <- thawMem (fromListMem [0 .. 5 :: Word8] :: Bytes 'Pin)&getCountMutMem mb :: IO (Count Word16)Count {unCount = 3}&getCountMutMem mb :: IO (Count Word32)Count {unCount = 1}&getCountMutMem mb :: IO (Count Word64)Count {unCount = 0}+mb' <- reallocMutMem mb (6 :: Count Word64)'getCountMutMem mb' :: IO (Count Word32)Count {unCount = 12} primal-memoryFigure out how many elements and a byte size remainder can fit into the mutable region of memory. Similar to , except it is a monadic action for mutable regions instead of a pure function for immutable memory. See % for getting the element count only.Examples:b <- thawMem (fromListMem [0 .. 5 :: Word8] :: Bytes 'Pin)getCountRemMutMem @Word16 b)(Count {unCount = 3},Count {unCount = 0})getCountRemMutMem @Word32 b)(Count {unCount = 1},Count {unCount = 2})getCountRemMutMem @Word64 b)(Count {unCount = 0},Count {unCount = 6}) primal-memoryAllocate the same amount of memory as the source memory region and copy all of its data over. primal-memoryCompare two memory regions byte-by-byte. Computation may be short-circuited on the first mismatch, but it is  implementation specific. primal-memory6Compare two memory regions for equality byte-by-byte. 1 is returned immediately when sizes reported by  do not match. primal-memory(Compare two memory regions byte-by-byte. primal-memoryConvert an immutable memory region to a list. Whenever memory byte count is not exactly divisible by the size of the element there will be some slack left unaccounted for. In order to get a hold of this slack use  instead.Examplesimport Data.Prim.Memoryimport Numeric (showHex)let b = fromByteListMem [0x48,0x61,0x73,0x6b,0x65,0x6c,0x6c] :: Bytes 'InctoListMem b :: [Int8][72,97,115,107,101,108,108] let xs = toListMem b :: [Word32]xs [1802723656]showHex (head xs) "" "6b736148" primal-memorySame as , except when there is some slack towards the end of the memory region that didn't fit into a list it will be returned as a list of bytes.Examplesimport Data.Word:set -XDataKinds4let a = fromListMem [0 .. 10 :: Word8] :: Bytes 'Pina8[0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a]&toListSlackMem a :: ([Word8], [Word8])([0,1,2,3,4,5,6,7,8,9,10],[])'toListSlackMem a :: ([Word16], [Word8])([256,770,1284,1798,2312],[10])'toListSlackMem a :: ([Word32], [Word8])([50462976,117835012],[8,9,10])'toListSlackMem a :: ([Word64], [Word8])([506097522914230528],[8,9,10]) primal-memoryRight fold that is useful for converting to a list while tapping into list fusion. UnsafeSupplying Count larger than memory holds will result in reading out of bounds and a potential segfault. primal-memory Just like , except it ensures safety by using the length of the list for allocation. Because it has to figure out the length of the list first it will be just a little bit slower, but that much safer.Examplesimport Data.Prim.Memory:set -XDataKindsfromListMem "Hi" :: Bytes 'Inc)[0x48,0x00,0x00,0x00,0x69,0x00,0x00,0x00] primal-memorySame as  but restricted to a list of . Load a list of bytes into a newly allocated memory region. Equivalent to  for Examples%fromByteListMem [0..10] :: Bytes 'Pin8[0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a] primal-memory Similarly to  load a list into a newly allocated memory region, but unlike the aforementioned function it also accepts a hint of how many elements is expected to be in the list. Because the number of expected an actual elements might not match we return not only the frozen memory region, but also:4either a list with leftover elements from the input list, if it did not fully fit into the allocated region. An empty list would indicate that it did fit exactly.  unCount memCount <= length list or an exact count of how many elements have been loaded when there was no enough elements in the listIn the latter case a zero value would indicate that the list did fit into the newly allocated memory region exactly, which is perfectly fine. But a positive value would mean that the tail of the memory region is still unset and might contain garbage data. Make sure to overwrite the surplus memory yourself or use the safe version # that fills the surplus with zeros. Unsafe Whenever memCount precodition is violated, because on each call with the same input it can produce different output therefore it will break referential transparency.Examples:set -XTypeApplications+fromListMemN @Char @(MBytes 'Inc) 3 "Hello"(Left "lo",[0x48,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00])(fromListMemN @Char @(MBytes 'Inc) 2 "Hi"3(Left "",[0x48,0x00,0x00,0x00,0x69,0x00,0x00,0x00]).fst $ fromListMemN @Char @(MBytes 'Inc) 5 "Hi"Right (Count {unCount = 2}) primal-memory Just like , except it ensures safety by filling tail with zeros, whenever the list is not long enough.Examplesimport Data.Prim.Memory:set -XTypeApplications,fromListZeroMemN @Char @(MBytes 'Inc) 3 "Hi"(Right (Count {unCount = 2}),[0x48,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00]) primal-memorySame as >, but ignore the extra information about how the loading went.Examplesimport Data.Prim.Memory&fromListZeroMemN_ 3 "Hi" :: Bytes 'Inc=[0x48,0x00,0x00,0x00,0x69,0x00,0x00,0x00,0x00,0x00,0x00,0x00] primal-memoryLoad elements from the supplied list into a mutable memory region. Loading will start at the supplied offset in number of bytes and will stop when either supplied  elemCount number is reached or there are no more elements left in the list to load. This action returns a list of elements that did not get loaded and the count of how many elements did get loaded. Unsafe,When any precondition for either the offset  memTargetOff or the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault.ExamplesFor example load the Hell somewhere in the middle of :>ma <- allocZeroMutMem (6 :: Count Char) :: IO (MBytes 'Inc RW)loadListByteOffMutMemN 4 "Hello!" ma (toByteOff (1 :: Off Char))("o!",Count {unCount = 4})freezeMutMem ma[0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00]Or something more useful like loading prefixes from nested lists:import Control.MonadfoldM_ (\o xs -> (+ o) . countToByteOff . snd <$> loadListByteOffMutMemN 4 xs ma o) 2 [[x..] | x <- [1..5] :: [Word8]]freezeMutMem ma[0x00,0x00,0x01,0x02,0x03,0x04,0x02,0x03,0x04,0x05,0x03,0x04,0x05,0x06,0x04,0x05,0x06,0x07,0x05,0x06,0x07,0x08,0x00,0x00] primal-memorySame as , but infer the count from number of bytes that is available in the target memory region. Unsafe*When a precondition for the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault.Examples:set -XDataKindsimport Data.Prim.Memory>ma <- allocZeroMutMem (5 :: Count Char) :: IO (MBytes 'Inc RW)freezeMutMem ma[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00](loadListByteOffMutMem "Hello World" ma 0(" World",Count {unCount = 5})freezeMutMem ma[0x48,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6f,0x00,0x00,0x00]8loadListByteOffMutMem ([0xff,0xff,0xff] :: [Word8]) ma 1([],Count {unCount = 3})freezeMutMem ma[0x48,0xff,0xff,0xff,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6f,0x00,0x00,0x00] primal-memorySame as , but works with offset in number of elements instead of bytes. Unsafe)When preconditions for either the offset  memTargetOff or the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault. primal-memorySame as , but start loading at 0 offset. Unsafe,When any precondition for the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault. primal-memorySame as , but ignores the result. Unsafe,When any precondition for the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault. primal-memorySame as , but infer the count from number of bytes that is available in the target memory region. Unsafe*When a precondition for the element count memCount is violated then a call to this function can result in heap corruption or failure with a segfault. primal-memorySame as , but tries to fit as many elements as possible into the mutable memory region starting at the beginning. This operation is always safe.Examplesimport Data.Prim.Memory:ma <- allocMutMem (5 :: Count Char) :: IO (MBytes 'Inc RW)loadListMutMem "HelloWorld" ma("World",Count {unCount = 5})freezeMutMem ma[0x48,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6f,0x00,0x00,0x00]/loadListMutMem (replicate 6 (0xff :: Word8)) ma([],Count {unCount = 6})freezeMutMem ma[0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x6c,0x00,0x00,0x00,0x6c,0x00,0x00,0x00,0x6f,0x00,0x00,0x00] primal-memorySame as 2, but ignores the result. Equivalence as property:let c = fromInteger (abs i) :: Count Int in (createZeroMemST_ c (loadListMutMem_ (xs :: [Int])) :: Bytes 'Inc) == createZeroMemST_ c (void . loadListMutMem xs) primal-memory:Convert a memory region to a list of bytes. Equivalent to  for Example5toByteListMem (fromByteListMem [0..10] :: Bytes 'Pin)[0,1,2,3,4,5,6,7,8,9,10] primal-memoryIterate over a region of memory primal-memory A list of  which covert bytes to base16 encoded strings. Each element of the list is a function that will convert one byte.Example:set -XDataKindsimport Data.Prim.MemoryconcatMap ($ " ") $ showsHexMem (fromListMem [1 :: Int16 .. 15] :: Bytes 'Inc)"01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 00 09 00 0a 00 0b 00 0c 00 0d 00 0e 00 0f 00 " primal-memoryAllocate a new region of memory and Ensure that it is filled with zeros before and after it gets used. d is not used directly, but instead is used to guarantee that the memory is pinned and its contents will not get moved around by the garbage collector.( primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type ePreconditions:  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBoundWhen converted to bytes the value should be less then available physical memory primal-memory memSource! - Source memory region to resize primal-memorymemCount7 - Number of elements for the reallocated memory regionPreconditions:  0 <= memCount-Should be less then available physical memory primal-memorymemRead( - Memory region to read an element from primal-memoryoff6 - Offset in number of elements from the beginning of memReadPreconditions: 0 <= offWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: count <- getByteCountMutMem memRead unOff (toByteOff off) <= unCount (count - byteCountType @e) primal-memorymemRead( - Memory region to read an element from primal-memoryoff6 - Offset in number of elements from the beginning of memReadPreconditions: 0 <= offWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: count <- getByteCountMutMem memRead unOff (toByteOff off) <= unCount (count - byteCountType @e) primal-memorymemWrite) - Memory region to write an element into primal-memoryoff6 - Offset in number of elements from the beginning of memWritePreconditions: 0 <= offWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: count <- getByteCountMutMem memWrite unOff (toByteOff off) <= unCount (count - byteCountType @e) primal-memoryelt - Element to write primal-memorymemWrite) - Memory region to write an element into primal-memoryoff6 - Offset in number of elements from the beginning of memWritePreconditions: 0 <= offWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: count <- getByteCountMutMem memWrite unOff (toByteOff off) <= unCount (count - byteCountType @e) primal-memory memSource# - Source memory from where to copy primal-memory memSourceOff/ - Offset in number of bytes into source memoryPreconditions: 0 <= memSourceOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOff (toByteOff memSourceOff) <= unCount (sourceByteCount - byteCountType @e) primal-memory memTarget# - Target memory into where to copy primal-memory memTargetOff - Offset in number of bytes into target memory where writing will startPreconditions: 0 <= memTargetOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOffBytes memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCountBoth source and target memory regions must have enough memory to perform a copy of memCount elements starting at their respective offsets. For types that also implement  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOff memSourceOff + unCountBytes memCount <= unCount (sourceByteCount - byteCountType @e) targetByteCount <- getByteCountMutMem memTarget unOff memTargetOff + unCountBytes memCount <= unCount (targetByteCount - byteCountType @e) primal-memory memSource# - Source memory from where to copy primal-memory memSourceOff/ - Offset in number of bytes into source memoryPreconditions: 0 <= memSourceOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOff (toByteOff memSourceOff) <= unCount (sourceByteCount - byteCountType @e) primal-memory memTarget# - Target memory into where to copy Precondition: Once the pointer is advanced by  memTargetOff the next unCountBytes memCount7 bytes must still belong to the same region of memory memTargetWrite primal-memory memTargetOff - Offset in number of bytes into target memory where writing will startPreconditions: 0 <= memTargetOff Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region  memTarget primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCountBoth source and target memory regions must have enough memory to perform a copy of memCount4 elements starting at their respective offsets. For  memSource that also implements  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOff memSourceOff + unCountBytes memCount <= unCount (sourceByteCount - byteCountType @e) primal-memory memSourceRead4 - Read-only source memory region from where to copy primal-memory memSourceOff/ - Offset into source memory in number of bytesPreconditions: 0 <= memSourceOff unOff memSourceOff <= unCount (byteCountMem memSourceRead - byteCountType @e) primal-memorymemTargetWrite - Target mutable memory primal-memory memTargetOff0 - Offset into target memory in number of bytesPreconditions: 0 <= memTargetOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTargetWrite unOffBytes memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCountBoth source and target memory regions must have enough memory to perform a copy of memCount4 elements starting at their respective offsets. For  memSourceRead: unOff memSourceOff + unCountBytes memCount <= unCount (byteCountMem memSourceRead - byteCountType @e)and for memTargetWrite that also implements  this can be described as: targetByteCount <- getByteCountMutMem memTargetWrite unOff memTargetOff + unCountBytes memCount <= unCount (targetByteCount - byteCountType @e) primal-memory memSource# - Source memory from where to copy primal-memory memSourceOff/ - Offset in number of bytes into source memoryPreconditions: 0 <= memSourceOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOffBytes memSourceOff <= unCount (sourceByteCount - byteCountType @e) primal-memory memTarget# - Target memory into where to copy primal-memory memTargetOff0 - Offset into target memory in number of bytesPreconditions: 0 <= memTargetOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOffBytes (toByteOff memTargetOff) <= unCount (targetByteCount - byteCountType @e) primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCountBoth source and target memory regions must have enough memory to perform a copy of memCount elements starting at their respective offsets. For types that also implement  this can be described as: sourceByteCount <- getByteCountMutMem memSource unOff memSourceOff + unCountBytes memCount <= unCount (sourceByteCount - byteCountType @e) targetByteCount <- getByteCountMutMem memTarget unOff memTargetOff + unCountBytes memCount <= unCount (targetByteCount - byteCountType @e) primal-memory memTarget0 - Target memory into where to write the element primal-memory memTargetOff - Offset into target memory in number of elements at which element setting should start.Preconditions: 0 <= memTargetOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOffBytes memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memorymemCount - Number of times the element elt should be writtenPreconditions:  0 <= memCountTarget memory region should have enough memory to perform a set operation of the supplied element memCount number of times starting at the supplied offset. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unCountBytes memCount + unOff memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memoryelt - Element to write into memory cells. This function is strict with respect to element, which means that the even  memCount = 0$ it might be still fully evaluated. primal-memorymemRead! - Memory to read an element from primal-memoryoff6 - Offset in number of elements from the beginning of memReadPreconditions: 0 <= off unOffBytes off <= unCount (byteCountMem memRead - byteCountType @e) primal-memorymemRead! - Memory to read an element from primal-memoryoff6 - Offset in number of elements from the beginning of memReadPreconditions: 0 <= unOff off >unOff off <= unCount (byteCountMem memRead - byteCountType @e) primal-memory memSourceRead - Source from where to copy primal-memory memSourceOff/ - Offset into source memory in number of bytesPreconditions: 0 <= memSourceOff unOff memSourceOff <= unCount (byteCountMem memSourceRead - byteCountType @e) primal-memorymemTargetWrite - Target mutable memory primal-memory memTargetOff0 - Offset into target memory in number of bytesPreconditions: 0 <= memTargetOff unOff memTargetOff <= unCount (byteCountMem memTargetWrite - byteCountType @e) primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCount unCountBytes memCount + unOff memSourceOff <= unCount (byteCountMem memSourceRead - byteCountType @e) unCountBytes memCount + unOff memTargetOff <= unCount (byteCountMem memTargetRead - byteCountType @e) primal-memory memSourceRead - Source from where to copy primal-memory memSourceOff/ - Offset into source memory in number of bytesPreconditions: 0 <= memSourceOff unOff memSourceOff <= unCount (byteCountMem memSourceRead - byteCountType @e) primal-memorymemTargetWrite' - Pointer to the target mutable memoryPreconditions: Once the pointer is advanced by  memTargetOff the next unCountBytes memCount7 bytes must still belong to the same region of memory memTargetWrite primal-memory memTargetOff* - Number of bytes to advance the pointer memTargetWrite forward Precondition: Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region memTargetWrite primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCount unCountBytes memCount + unOff memSourceOff <= unCount (byteCountMem memSourceRead - byteCountType @e) primal-memorymemRead1 - First memory region primal-memorymemOff1 - Offset for memRead1 in number of bytesPreconditions:  0 <= memOff1 unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) primal-memorymemRead28- Second memory region that can be accessed by a pointer Preconditions Once the pointer is advanced by memOff2 the next unCountBytes memCount7 bytes must still belong to the same region of memory memRead2 primal-memorymemOff2* - Number of bytes to advance the pointer memRead2 forward Precondition: Once the pointer is advanced by memOff20 it must still refer to the same memory region memRead2 primal-memorymemCount - Number of elements of type e to compare as binary ^ memCount - Number of elements of type e to compare as binaryPreconditions:  0 <= memCount unCountBytes memCount + unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) primal-memorymemRead1 - First memory region primal-memorymemOff1 - Offset for memRead1 in number of bytesPreconditions:  0 <= memOff1 unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) primal-memorymemRead2)- Second memory region that is backed by  primal-memorymemOff2 - Offset for memRead2 in number of bytesPreconditions:  0 <= memOff2 unOff memOff2 <= unCount (byteCountMem memRead2 - byteCountType @e) primal-memorymemCount - Number of elements of type e to compare as binaryPreconditions:  0 <= memCount unCountBytes memCount + unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) unCountBytes memCount + unOff memOff2 <= unCount (byteCountMem memRead2 - byteCountType @e) primal-memorymemRead1 - First memory region primal-memorymemOff1 - Offset for memRead1 in number of bytesPreconditions:  0 <= memOff1 unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) primal-memorymemRead2 - Second memory region primal-memorymemOff2 - Offset for memRead2 in number of bytesPreconditions:  0 <= memOff2 unOff memOff2 <= unCount (byteCountMem memRead2 - byteCountType @e) primal-memorymemCount - Number of elements of type e to compare as binaryPreconditions:  0 <= memCount unCountBytes memCount + unOff memOff1 <= unCount (byteCountMem memRead1 - byteCountType @e) unCountBytes memCount + unOff memOff2 <= unCount (byteCountMem memRead2 - byteCountType @e) primal-memoryThe single element that will be stored in the newly allocated region of memory primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type ePreconditions:  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBoundWhen converted to bytes the value should be less then available physical memory primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type ePreconditions:  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBoundWhen converted to bytes the value should be less then available physical memory primal-memory memFillAction - This action will be used to modify the contents of newly allocated memory. Make sure to overwrite all of it, otherwise it might lead to breaking referential transparency. primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type ePreconditions:  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBoundWhen converted to bytes the value should be less then available physical memory primal-memory memFillAction - This action will be used to modify the contents of newly allocated memory. Make sure to overwrite all of it, otherwise it might lead to breaking referential transparency. primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type ePreconditions:  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBoundWhen converted to bytes the value should be less then available physical memory primal-memory fillAction -- Action that will be used to modify contents of newly allocated memory. It is not required to overwrite the full region, since the whole thing will be reset to zeros before applying this action. primal-memorymemCount - Amount of memory to allocate for the region in number of elements of type e Precoditions:Size should be non-negative, but smaller than amount of available memory. Note that the second condition simply describes overflow.  0 <= memCountPossibility of overflow: "memCount <= fromByteCount maxBound primal-memory fillAction -- Action that will be used to modify contents of newly allocated memory. It is not required to overwrite the full region, since the whole thing will be reset to zeros before applying this action. primal-memory memSource - immutable source memory. primal-memory memSourceRead - Read-only source memory region from which the data will copied primal-memory memSourceOff; - Offset into source memory in number of elements of type ePreconditions: 0 <= memSourceOff 5unOff memSourceOff < unCount (countMem memSourceRead) primal-memorymemTargetWrite - Target mutable memory primal-memory memTargetOff3 - Offset into target memory in number of elementsPreconditions: 0 <= memTargetOffWith offset applied it should still refer to the same memory region. For types that also implement  this can be described as: targetCount <- getCountMutMem memTargetWrite unOff memTargetOff < unCount targetCount primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCountBoth source and target memory regions must have enough memory to perform a copy of memCount4 elements starting at their respective offsets. For  memSourceRead: unOff memSourceOff + unCount memCount < unCount (countMem memSourceRead)and for memTargetWrite that also implements  this can be described as: targetCount <- getCountMutMem memTargetWrite unOff memTargetOff + unCount memCount < unCount targetCount primal-memorySource memory region primal-memory,Offset into the source in number of elements primal-memoryDestination memory region primal-memory-Offset into destination in number of elements primal-memoryNumber of elements to copy over primal-memory memSource - Read-only source memory region from which the data will copied and thawed primal-memory memSourceOff; - Offset into source memory in number of elements of type ePreconditions: 0 <= memSourceOff 1unOff memSourceOff < unCount (countMem memSource) primal-memorymemCount - Number of elements of type e to copyPreconditions:  0 <= memCount unOff memSourceOff + unCount memCount < unCount (countMem memSource) primal-memorymemRead1 - First region of memory primal-memorymemOff1 - Offset for memRead1 in number of bytes Precondition:  0 <= memOff1 primal-memorymemRead2 - Second region of memory primal-memorymemOff2 - Offset for memRead1 in number of bytes Precondition:  0 <= memOff2 primal-memorymemCount - Number of bytes comparePreconditions:  0 <= memCount 1offToCount memOff1 + memCount < countMem memRead1 1offToCount memOff2 + memCount < countMem memRead2 primal-memorymemCount - Expected number of elements in the list, which exactly how much memory will be allocated.Preconditions: -0 <= memCount unCount memCount <= length list primal-memorylist - A list of elements to load into the newly allocated memory region. primal-memorymemCount, - Number of elements to load from the list. primal-memoryOffset primal-memory Upper bound primal-memory Element size primal-memory elemCount - Maximum number of elements to load from list into the memory regionPreconditions:  0 <= memCountTarget memory region must have enough memory to perform loading of  elemCount elements starting at the  memTargetOff( offset. For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOff memTargetOff + unCountBytes elemCount <= unCount (targetByteCount - byteCountType @e) primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memory memTargetOff - Offset in number of bytes into target memory where writing will startPreconditions: 0 <= memTargetOff Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region  memTarget . For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOff memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memory memTargetOff - Offset in number of bytes into target memory where writing will startPreconditions: 0 <= memTargetOff Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region  memTarget . For types that also implement  this can be described as: targetByteCount <- getByteCountMutMem memTarget unOff memTargetOff <= unCount (targetByteCount - byteCountType @e) primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory elemCount - Maximum number of elements to load from list into the memory regionPreconditions:  0 <= memCountTarget memory region must have enough memory to perform loading of  elemCount elements starting at the  memTargetOff( offset. For types that also implement  this can be described as: targetCount <- getCountMutMem memTarget unOff memTargetOff + unCount elemCount < unCount targetCount primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memory memTargetOff - Offset in number of elements into target memory where writing will startPreconditions: 0 <= memTargetOff Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region  memTarget . For types that also implement  this can be described as: targetCount <- getByteCountMutMem memTarget unOff memTargetOff < unCount targetCount primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory elemCount - Maximum number of elements to load from list into the memory regionPreconditions:  0 <= memCountTarget memory region must have enough memory to perform loading of  elemCount* elements. For types that also implement  this can be described as: targetCount <- getCountMutMem memTarget elemCount <= targetCount primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory elemCount - Maximum number of elements to load from list into the memory regionPreconditions:  0 <= memCountTarget memory region must have enough memory to perform loading of  elemCount* elements. For types that also implement  this can be described as: targetCount <- getCountMutMem memTarget elemCount <= targetCount primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memory listSource+ - List with elements that should be loaded primal-memory memTarget0 - Memory region where to load the elements into primal-memory memTargetOff - Offset in number of elements into target memory where writing will startPreconditions: 0 <= memTargetOff Once the pointer is advanced by  memTargetOff0 it must still refer to the same memory region  memTarget . For types that also implement  this can be described as: targetCount <- getCountMutMem memTarget unOff memTargetOff < unCount targetCount primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory listSource - List with elements to load primal-memory memTarget6 - Mutable region where to load elements from the list primal-memoryLeftover part of the  listSource> if any and the exact count of elements that have been loaded. primal-memory listSource - List with elements to load primal-memory memTarget6 - Mutable region where to load elements from the list !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNoneU primal-memory"Right fold with a lazy accumulator primal-memoryRight fold with a lazy accumulator using an offset aware function primal-memory3Check two regions of memory for equality using the  instance. It will return : whenever both regions hold exactly the same elements and  as soon as the first pair of mismatched elements is discovered in the two regions. It is safe for both regions to refer to the same part of memory. Unsafe0When any precondition for either of the offsets memOff1, memOff2 or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memoryCompare two mutable memory regions for element equality. Regions themselves are not modified, as such it is semantically similar to # which works on immutable regions. primal-memoryCompare two regions using the  instance. It will return ; whenever both regions hold exactly the same elements and  or  as soon as the first discovered element that is less than or greater than respectfully in the first region when compared to the second one. It is safe for both regions to refer to the same part of memory. primal-memoryCompare two regions using the  instance. It will return ; whenever both regions hold exactly the same elements and  or  as soon as the first discovered element that is less than or greater than respectfully in the first region when compared to the second one. It is safe for both regions to refer to the same part of memory. Unsafe0When any precondition for either of the offsets memOff1, memOff2 or the element count memCount is violated the result is either unpredictable output or failure with a segfault. primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryInitial offset to start at primal-memory+Total number of elements to iterate through primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryInitial offset to start at primal-memory+Total number of elements to iterate through primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryInitial offset to start at primal-memory+Total number of elements to iterate through primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memoryInitial offset to start at primal-memory+Total number of elements to iterate through primal-memoryFolding function primal-memoryInitial accumulator primal-memoryMemory region to iterate over primal-memorymemRead1 - First region of memory primal-memorymemOff1 - Offset for memRead1 in number of elements Precondition:  0 <= memOff1 primal-memorymemRead2 - Second region of memory primal-memorymemOff2 - Offset for memRead1 in number of elements Precondition:  0 <= memOff2 primal-memorymemCount - Number of elements of type e to comparePreconditions:  0 <= memCount 1offToCount memOff1 + memCount < countMem memRead1 1offToCount memOff2 + memCount < countMem memRead2 primal-memorymemRead1 - First region of memory primal-memorymemRead2 - Second region of memory primal-memorymemRead1 - First region of memory primal-memorymemOff1 - Offset for memRead1 in number of elements Precondition:  0 <= memOff1 primal-memorymemRead2 - Second region of memory primal-memorymemOff2 - Offset for memRead1 in number of elements Precondition:  0 <= memOff2 primal-memorymemCount - Number of elements of type e to comparePreconditions:  0 <= memCount 1offToCount memOff1 + memCount < countMem memRead1 1offToCount memOff2 + memCount < countMem memRead2(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/>?J9# primal-memoryThis function allows the change of state token. Use with care, because it can allow mutation to escape the  monad. primal-memoryAllocated memory is not cleared, so make sure to fill it in properly, otherwise you might find some garbage there. primal-memory.Fill the mutable array with zeros efficiently. primal-memory"Get the count of elements of type a that can fit into bytes as well as the slack number of bytes that would be leftover in case when total number of bytes available is not exactly divisable by the size of the element that will be stored in the memory chunk. primal-memory#Get the number of elements of type a that can fit into bytes as well as the slack number of bytes that would be leftover in case when total number of bytes available is not exactly divisable by the size of the element that will be stored in the memory chunk. primal-memoryIt is only guaranteed to convert the whole memory to a list whenever the size of allocated memory is exactly divisible by the size of the element, otherwise there will be some slack left unaccounted for. primal-memorySame as  primal-memorySame as  primal-memorySame as  primal-memory Exactly like , but restricted to . primal-memoryAllocate new memory region and append second bytes region after the first one primal-memory1Perform atomic modification of an element in the  at the supplied index. Returns the actual value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the ! at the supplied index. Returns  if swap was successfull and false otherwise. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory Just like , but also returns the actual value, which will match the supplied expected value if the returned flag is Note= - Bounds are not checked, therefore this function is unsafe. primal-memoryPerform atomic read of  at the supplied index. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memoryPerform a write into  at the supplied index atomically. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the = at the supplied index. Returns the artifact of computation b. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the  at the supplied index. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the  at the supplied index. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the  at the supplied index. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory1Perform atomic modification of an element in the  at the supplied index. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory'Add a numeric value to an element of a , corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory'Add a numeric value to an element of a , corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory.Subtract a numeric value from an element of a , corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory.Subtract a numeric value from an element of a , corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory,Binary conjunction (AND) of an element of a * with the supplied value, corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory,Binary conjunction (AND) of an element of a * with the supplied value, corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory9Negation of binary conjunction (NAND) of an element of a * with the supplied value, corresponds to \x y ->  (x  y) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory:Negation of binary conjunction (NAND) of an element of a * with the supplied value, corresponds to \x y ->  (x  y) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory+Binary disjunction (OR) of an element of a * with the supplied value, corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory+Binary disjunction (OR) of an element of a * with the supplied value, corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory6Binary exclusive disjunction (XOR) of an element of a * with the supplied value, corresponds to  done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory6Binary exclusive disjunction (XOR) of an element of a * with the supplied value, corresponds to  done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory)Binary negation (NOT) of an element of a , corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory)Binary negation (NOT) of an element of a , corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe.  primal-memoryFirst memory region primal-memorySecond memory region primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryFunction that is applied to the old value and returns new value and some artifact of computation b primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryFunction that is applied to the old value and returns new value. primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryFunction that is applied to the old value and returns the new value primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryFunction that is applied to the old value and returns the new value primal-memoryArray to be mutated primal-memoryIndex is in elements of a, rather than bytes. primal-memoryFunction that is applied to the old value and returns the new value !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJK:;2301IJK!",4 +*#%&$'(-./)56789<CDEFABGH>=@?(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/>?Q  primal-memory&A mutable array with elements of type e primal-memory)An immutable array with elements of type e primal-memoryO(1) - Cast  to  primal-memoryO(1) - Cast  to  primal-memoryO(1) - Cast  to  primal-memoryO(1) - Cast  to  primal-memoryShrink mutable bytes to new specified count of elements. The new count must be less than or equal to the current count as reported by getCountPMArray. primal-memory)Attempt to resize mutable bytes in place.:New bytes might be allocated, with the copy of an old one.Old references should not be kept around to allow GC to claim it=Old references should not be used to avoid undefined behavior primal-memory)Read-only access, but it is not enforced. primal-memorySize in number of bytes primal-memoryChunk of memory to fill primal-memoryOffset in number of elements primal-memoryNumber of cells to fill primal-memoryA value to fill the cells with## (c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNone/>?- primal-memoryMutable address primal-memoryImmutable read-only address primal-memoryShrink mutable address to new specified size in number of elements. The new count must be less than or equal to the current as reported by . primal-memoryShrink mutable address to new specified size in bytes. The new count must be less than or equal to the current as reported by . primal-memory0This is a unsafe cast therefore modification of + will be reflected in resulting immutable . Pointer created with malloc cannot be converted to  and will result in  primal-memoryDiscarding the original ForeignPtr will trigger finalizers that were attached to it, because 6 does not retain any finalizers. Pointer created with malloc cannot be converted to  and will result in  primal-memoryApply a pure function to the contents of a mutable variable. Returns the artifact of computation. primal-memory  (x  y) done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory:Negation of binary conjunction (NAND) of an element of a * with the supplied value, corresponds to \x y ->  (x  y) done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory+Binary disjunction (OR) of an element of a * with the supplied value, corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory+Binary disjunction (OR) of an element of a * with the supplied value, corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory6Binary exclusive disjunction (XOR) of an element of a * with the supplied value, corresponds to  done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory6Binary exclusive disjunction (XOR) of an element of a * with the supplied value, corresponds to  done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory)Binary negation (NOT) of an element of a , corresponds to () done atomically. Returns the previous value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory)Binary negation (NOT) of an element of a , corresponds to () done atomically. Returns the new value. Offset is in number of elements, rather than bytes. Implies a full memory barrier.Note= - Bounds are not checked, therefore this function is unsafe. primal-memory)Read-only access, but it is not enforced.  primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryExpected old value primal-memory New value primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memoryFunction that is applied to the old value and returns new value and some artifact of computation b primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memory-Function that is applied to the current value primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes. primal-memory)Function that is applied to the old value primal-memoryReturns the old value primal-memoryArray to be mutated primal-memoryIndex is in elements of e, rather than bytes primal-memory)Function that is applied to the old value primal-memoryReturns the new value(c) Alexey Kuleshevich 2020BSD3(Alexey Kuleshevich  experimental non-portableNoned !" !# !$ !" !% !& !' !( !) !*+,-+.+/0+,1+.234534536736836836936:36: ; < = > ?  @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k lmnopqrstuvwxyyz{|}~                                                                                                                               ; <                                                                                                           + !   ! ! ! ! ! ! ! ! ! !    ,primal-memory-0.3.0.0-DSsPJTUM50T3ZkbSELBVpSData.Prim.Memory.ForeignPtrData.Prim.Memory.ByteStringData.Prim.Memory.TextData.Prim.Memory.BytesData.Prim.Memory.PtrData.Prim.MemoryData.Prim.Memory.FoldData.Prim.Memory.PArrayData.Prim.Memory.AddrData.Prim.Memory.Bytes.InternalfromMutableByteArray#toMutableByteArray#fromByteArray# toByteArray# toPinnedBytestoPinnedMBytesForeign.ForeignPtrmallocForeignPtrArraymallocPlainForeignPtrArrayData.Prim.Memory.InternalControl.Exception HeapOverflowData.ByteStringpack ByteStringunpack Data.Bits.&. complement.|.xorbaseGHC.ForeignPtr ForeignPtrcastForeignPtrunsafeForeignPtrToPtrPlainPtr MallocPtrPlainForeignPtrForeignPtrContents FinalizerPtrFinalizerEnvPtrbytestring-0.10.10.0Data.ByteString.Short.InternalShortByteStringData.ByteString.Internal Data.ByteString.Builder.InternalBuilderSBSPS text-1.2.3.2Data.Text.InternalTextData.Text.ArrayaBAArraymaBAMArrayMBytesBytesPinnedPinInccompareByteOffBytes indexOffBytesindexByteOffBytes allocMBytesallocUnpinnedMBytesallocPinnedMBytesallocAlignedMBytesallocZeroPinnedMBytesallocZeroAlignedMBytesgetByteCountMBytes freezeMBytes thawBytesbyteCountBytes shrinkMBytes resizeMBytes reallocMBytesrelaxPinnedBytesrelaxPinnedMBytestoInconclusiveBytestoInconclusiveMBytes countBytesgetCountMBytes readOffMBytesreadByteOffMByteswriteOffMByteswriteByteOffMBytes isPinnedBytesisPinnedMBytes setMBytesfromUArrayBytes toUArrayBytesfromUMArrayMBytestoUMArrayMBytes toPtrBytes toPtrMBytes withPtrByteswithNoHaltPtrBytes withPtrMByteswithNoHaltPtrMBytestoForeignPtrBytestoForeignPtrMBytes isSameBytesisSamePinnedBytes isSameMBytesbyteStringConvertErrorcopyPtrToMBytescopyByteOffPtrToMBytescopyBytesToPtrcopyByteOffBytesToPtrcopyMBytesToPtrcopyByteOffMBytesToPtrmovePtrToMBytesmoveByteOffPtrToMBytesmoveMBytesToPtrmoveByteOffMBytesToPtrcompareByteOffBytesToPtrcompareByteOffPtrToBytes MByteStringtoByteStringBytestoShortByteStringBytesfromShortByteStringBytestoBuilderBytesfromBuilderBytesfromLazyByteStringBytesfromByteStringByteswithPtrByteStringwithNoHaltPtrByteString PtrAccess toForeignPtr withPtrAccesswithNoHaltPtrAccesswithForeignPtrwithNoHaltForeignPtrtouchForeignPtr newForeignPtrnewForeignPtrEnvnewForeignPtr_mallocForeignPtrmallocCountForeignPtrmallocCountForeignPtrAlignedmallocByteCountForeignPtr mallocByteCountForeignPtrAlignedaddForeignPtrFinalizeraddForeignPtrFinalizerEnvmallocPlainForeignPtrmallocCountPlainForeignPtr!mallocCountPlainForeignPtrAlignedmallocByteCountPlainForeignPtr%mallocByteCountPlainForeignPtrAlignednewConcForeignPtraddForeignPtrConcFinalizerfinalizeForeignPtrplusOffForeignPtrplusByteOffForeignPtrminusByteOffForeignPtrminusOffForeignPtrminusOffRemForeignPtr$fPtrAccesssMBytes$fPtrAccesssBytes$fPtrAccesssMByteString$fPtrAccesssByteString$fPtrAccessRealWorldForeignPtrMTextfromArrayBytes toArrayBytesfromMArrayMBytestoMArrayMBytesMemState unMemStateMemAlloc FrozenMemgetByteCountMutMem allocMutMemthawMem freezeMutMem reallocMutMemMemWrite readOffMutMemreadByteOffMutMemwriteOffMutMemwriteByteOffMutMemmoveByteOffToMBytesMutMemmoveByteOffToPtrMutMemcopyByteOffMemmoveByteOffMutMem setMutMemMemRead byteCountMem indexOffMemindexByteOffMemcopyByteOffToMBytesMemcopyByteOffToPtrMemcompareByteOffToPtrMemcompareByteOffToBytesMemcompareByteOffMemmodifyFetchOldMutMemmodifyFetchNewMutMemmodifyFetchOldMutMemMmodifyFetchNewMutMemMdefaultReallocMutMem cycleMemNemptyMem singletonMemallocZeroMutMem createMemST createMemST_createZeroMemSTcreateZeroMemST_cloneMemcopyMem moveMutMem thawCloneMem thawCopyMemfreezeCopyMutMemfreezeCloneMutMem convertMemcountMem countRemMemgetCountMutMemgetCountRemMutMem cloneMutMem eqByteOffMem eqByteMemcompareByteMem toListMemtoListSlackMem foldrCountMem fromListMemfromByteListMem fromListMemNfromListZeroMemNfromListZeroMemN_loadListByteOffMutMemNloadListByteOffMutMemloadListOffMutMemNloadListMutMemNloadListMutMemN_loadListOffMutMemloadListMutMemloadListMutMem_ toByteListMem showsHexMemwithScrubbedMutMemfoldlMem ifoldlMem ifoldlOffMem foldlLazyMem ifoldlLazyMemifoldlLazyOffMemfoldrMem ifoldrMem ifoldrOffMem foldrLazyMem ifoldrLazyMemifoldrLazyOffMem foldMapOffMemifoldMapOffMem anyOffMem ianyOffMemanyMemianyMem allOffMem iallOffMemallMemiallMemeqMemeqOffMemeqOffMemBinary eqOffMutMemeqMutMem compareMem compareOffMemeqBytes compareBytescoerceStateMBytes emptyBytes isEmptyBytessingletonBytessingletonMBytes cloneBytes cloneMBytescopyBytesToMBytesmoveMBytesToMBytes createBytes createBytes_ createBytesSTcreateBytesST_allocZeroMBytes zeroMByteswithCloneMByteswithCloneMBytes_withCloneMBytesSTwithCloneMBytesST_ countRemBytesgetCountRemOfMBytes toListBytestoListSlackBytesloadListMBytesloadListMBytes_fromListZeroBytesN_fromListBytesN fromListBytes appendBytes concatBytesensurePinnedBytesensurePinnedMBytes casMBytes casBoolMBytescasBoolFetchMBytesatomicReadMBytesatomicWriteMBytesatomicModifyMBytesatomicModifyMBytes_atomicModifyFetchOldMBytesatomicBoolModifyFetchOldMBytesatomicModifyFetchNewMBytesatomicAddFetchOldMBytesatomicAddFetchNewMBytesatomicSubFetchOldMBytesatomicSubFetchNewMBytesatomicAndFetchOldMBytesatomicAndFetchNewMBytesatomicNandFetchOldMBytesatomicNandFetchNewMBytesatomicOrFetchOldMBytesatomicOrFetchNewMBytesatomicXorFetchOldMBytesatomicXorFetchNewMBytesatomicNotFetchOldMBytesatomicNotFetchNewMBytesprefetchBytes0prefetchMBytes0prefetchBytes1prefetchMBytes1prefetchBytes2prefetchMBytes2prefetchBytes3prefetchMBytes3PMArrayPArray castPArraytoUArrayPArrayfromUArrayPArrayfromBytesPArray toBytesPArray castPMArrayfromMBytesPMArraytoMBytesPMArraytoUMArrayPMArrayfromUMArrayPMArray sizePArraygetSizePMArray allocPMArrayallocUnpinnedPMArrayallocPinnedPMArrayallocAlignedPMArray freezePMArray thawPArray shrinkPMArray resizePMArrayreallocPMArrayisPinnedPArrayisPinnedPMArray readPMArray writePMArray setPMArraycopyPArrayToPMArraymovePMArrayToPMArray $fShowPArray$fIsStringPArray$fIsListPArray$fPtrAccesssPArray $fOrdPArray $fEqPArray$fMemAllocPMArray$fPtrAccesssPMArray$fNFDataPMArray$fMemWritePMArray$fNFDataPArray$fSemigroupPArray$fMonoidPArray$fMemReadPArrayMAddr mAddrAddr# mAddrMBytesAddr addrAddr# addrBytescastAddr castMAddr fromBytesAddrnewMAddr allocMAddrallocZeroMAddrallocAlignedMAddrallocZeroAlignedMAddr shrinkMAddrshrinkByteCountMAddr reallocMAddr plusOffAddrplusByteOffAddr plusOffMAddrplusByteOffMAddr curOffAddr countAddr byteCountAddr getCountMAddrgetByteCountMAddr indexAddr indexOffAddrindexByteOffAddr withPtrAddr withAddrAddr#withNoHaltPtrAddr curOffMAddr withPtrMAddrtoForeignPtrAddrtoForeignPtrMAddrfromForeignPtrAddrfromForeignPtrMAddrwithAddrMAddr#withNoHaltPtrMAddrthawAddr freezeMAddrreadAddr readOffAddrreadByteOffAddr readMAddr readOffMAddrreadByteOffMAddr writeMAddr writeOffMAddrwriteByteOffMAddrcopyAddrToMAddrmoveMAddrToMAddrsetMAddr modifyMAddr modifyMAddr_modifyFetchOldMAddrmodifyFetchNewMAddr modifyMAddrMmodifyFetchOldMAddrMmodifyFetchNewMAddrM modifyMAddrM_ swapMAddrs swapMAddrs_toByteStringAddrtoShortByteStringAddrfromShortByteStringAddrfromByteStringAddrfromByteStringMAddr casOffMAddrcasBoolOffMAddrcasBoolFetchOffMAddratomicReadOffMAddratomicWriteOffMAddratomicModifyOffMAddratomicModifyOffMAddr_atomicModifyFetchOldOffMAddratomicModifyFetchNewOffMAddratomicAddFetchOldOffMAddratomicAddFetchNewOffMAddratomicSubFetchOldOffMAddratomicSubFetchNewOffMAddratomicAndFetchOldOffMAddratomicAndFetchNewOffMAddratomicNandFetchOldOffMAddratomicNandFetchNewOffMAddratomicOrFetchOldOffMAddratomicOrFetchNewOffMAddratomicXorFetchOldOffMAddratomicXorFetchNewOffMAddratomicNotFetchOldOffMAddratomicNotFetchNewOffMAddr prefetchAddr0prefetchMAddr0 prefetchAddr1prefetchMAddr1 prefetchAddr2prefetchMAddr2 prefetchAddr3prefetchMAddr3prefetchOffAddr0prefetchOffMAddr0prefetchOffAddr1prefetchOffMAddr1prefetchOffAddr2prefetchOffMAddr2prefetchOffAddr3prefetchOffMAddr3 $fMemReadAddr$fPtrAccesssAddr $fNFDataAddr $fMonoidAddr$fSemigroupAddr $fIsListAddr$fIsStringAddr $fShowAddr $fOrdAddr$fEqAddr$fMemWriteMAddr$fMemAllocMAddr$fPtrAccesssMAddr $fNFDataMAddrcastPinnedMBytesghc-primGHC.Prim ByteArray#MutableByteArray#castForeignPtrToBytescopyByteOffBytesToMBytesmoveByteOffMBytesToMBytescastStateMBytescastPinnedBytesonForeignPtrContentscoerceData.Typeable.InternalTypeableGHC.Base Semigroupstimes<>sconcatMonoidmconcatmemptymappend GHC.TypesIntGHC.IntInt8Int16Int32Int64 RealWorldWordGHC.WordWord8Word16Word32Word64GHC.PtrPtrFunPtr CoercibleGHC.STSTData.Semigroupoption mtimesDefaultdiffcycle1MingetMinMaxgetMaxArgArgMinArgMaxFirstgetFirstLastgetLast WrappedMonoid WrapMonoid unwrapMonoidOption getOption Data.MonoidApgetApData.Semigroup.Internal stimesMonoidstimesIdempotentDualgetDualEndoappEndoAllgetAllAnygetAnySumgetSumProduct getProductAltgetAlt Data.ProxyProxy Foreign.Ptr intPtrToPtr ptrToIntPtr wordPtrToPtr ptrToWordPtrWordPtrIntPtrcastPtrToFunPtrcastFunPtrToPtr castFunPtr nullFunPtrminusPtralignPtrplusPtrcastPtrnullPtr bitReverse64 bitReverse32 bitReverse16 bitReverse8 byteSwap64 byteSwap32 byteSwap16runSTstimesIdempotentMonoid$primal-0.3.0.0-GhltlpugzpW2pg0rorinVForeign.Prim.PtrfreeHaskellFunPtrprefetchOffPtr3prefetchOffPtr2prefetchOffPtr1prefetchOffPtr0 prefetchPtr3 prefetchPtr2 prefetchPtr1 prefetchPtr0atomicNotFetchNewOffPtratomicNotFetchOldOffPtratomicXorFetchNewOffPtratomicXorFetchOldOffPtratomicOrFetchNewOffPtratomicOrFetchOldOffPtratomicNandFetchNewOffPtratomicNandFetchOldOffPtratomicAndFetchNewOffPtratomicAndFetchOldOffPtratomicSubFetchNewOffPtratomicSubFetchOldOffPtratomicAddFetchNewOffPtratomicAddFetchOldOffPtratomicModifyFetchNewOffPtratomicModifyFetchOldOffPtratomicModifyOffPtr_atomicModifyOffPtr casOffPtrcompareByteOffPtrToPtrcomparePtrToPtrmoveByteOffPtrToPtr movePtrToPtrcopyByteOffPtrToPtr copyPtrToPtrminusOffRemPtr minusOffPtrminusByteOffPtr plusOffPtrplusByteOffPtrwritePtrreadPtrwriteByteOffPtr writeOffPtrreadByteOffPtr readOffPtr setOffPtr Data.Prim.##.prefetchValue3prefetchValue2prefetchValue1prefetchValue0fromByteOffRem fromByteOff unOffBytes# unOffBytes toByteOffoffToByteCount offToCount offForTypeoffForProxyTypeOffromByteCountRem fromByteCount countForTypecountForProxyTypeOfcountToByteOff countToOff toByteCount unCountBytes unCountBytes#alignmentProxy alignmentType alignmentbyteCountProxy byteCountType byteCount showsTypeCountunCountOffunOffData.Prim.AtomAtomunAtomData.Prim.AtomicAtomic AtomicCount AtomicBitsData.Prim.ClassPrimControl.Prim.Monad.InternalRW MonadPrimData.ByteString.Lazy.InternalForeign.ForeignPtr.ImpmallocForeignPtrBytesmallocForeignPtrAlignedBytesIO isSameMutMem isSameMemLTGTFalseforByteOffMemM_GHC.ShowShowSloadListByteOffHelperMMemViewmmvMem mmvOffsetmmvCountMemViewmvMemmvOffsetmvCount appendMem concatMem mapByteMemimapByteOffMem mapByteMemMmapByteOffMemMizipWithByteOffMemM_izipWithOffMemM_ GHC.ClassesEqTrueOrdEQGHC.Num+-Data.Prim.ArrayUArrayUMArray GHC.MaybeNothing