úΊëƒyv      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu  Safe-Inferedv non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-Infered   !"   !" "!     !" non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-Infered #,Class of primitive state-transformer monads $State token type %Execute a primitive operation &+Expose the internal structure of the monad '-Execute a primitive operation with no result ( Convert a #- to another monad with the same state token. ) Convert a # with a  state token to w * Convert a # to x + Convert a #2 to another monad with a possibly different state ) token. This operation is highly unsafe! , Convert any # to x% with an arbitrary state token. This  operations is highly unsafe! - Convert any # to w#. This operation is highly unsafe! #$%&'()*+,-./01yz#$%&'()*+,-./01#$%&'()*+-,./01#$%&'()*+,-./01yz non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-Infered 25Class of types supporting primitive array operations 3Size of values of type a. The argument is not used. 4Alignment of values of type a. The argument is not used. 5?Read a value from the array. The offset is in elements of type  a rather than in bytes. 6GRead a value from the mutable array. The offset is in elements of type  a rather than in bytes. 7FWrite a value to the mutable array. The offset is in elements of type  a rather than in bytes. 8GRead a value from a memory position given by an address and an offset. L The memory block the address refers to must be immutable. The offset is in  elements of type a rather than in bytes. 9GRead a value from a memory position given by an address and an offset. # The offset is in elements of type a rather than in bytes. :FWrite a value to a memory position given by an address and an offset. # The offset is in elements of type a rather than in bytes. ;A machine address 23456789:;<{|}~€‚ƒ„…†‡ˆ‰Š‹ 23456789:;< 23456789:;<23456789:;<{|}~€‚ƒ„…†‡ˆ‰Š‹ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-Infered =>Mutable boxed arrays associated with a primitive state token. ? Boxed arrays ADCreate a new mutable array of the specified size and initialise all  elements with the given value. B0Read a value from the array at the given index. C/Write a value to the array at the given index. D:Read a value from the immutable array at the given index. EFMonadically read a value from the immutable array at the given index. K This allows us to be strict in the array while remaining lazy in the read L element which is very useful for collective operations. Suppose we want to 1 copy an array. We could do something like this:   copy marr arr ... = do ... A writeArray marr i (indexArray arr i) ...  ... 2But since primitive arrays are lazy, the calls to D will not be  evaluated. Rather, marr0 will be filled with thunks each of which would  retain a reference to arr'. This is definitely not what we want! With E, we can instead write   copy marr arr ... = do ... / x <- indexArrayM arr i , writeArray marr i x  ... GNow, indexing is executed immediately although the returned element is  still not evaluated. FAConvert a mutable array to an immutable one without copying. The 4 array should not be modified after the conversion. GBConvert an immutable array to an mutable one without copying. The : immutable array should not be used after the conversion. H=Check whether the two arrays refer to the same memory block. I7Copy a slice of an immutable array to a mutable array. JECopy a slice of a mutable array to another array. The two arrays may  not be the same. =>?@ABCDEFGHIdestination array offset into destination array  source array offset into source array number of elements to copy Jdestination array offset into destination array  source array offset into source array number of elements to copy Œ=>?@ABCDEFGHIJ?@=>ABCDEFGHIJ=>?@ABCDEFGHIJŒ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-InferedK<Mutable byte arrays associated with a primitive state token M Byte arrays O7Create a new mutable byte array of the specified size. P Create a pinned9 byte array of the specified size. The garbage collector  is guaranteed not to move it. Q Create a pinned4 byte array of the specified size and with the give @ alignment. The garbage collector is guaranteed not to move it. RYield a pointer to the array''s data. This operation is only safe on  pinned byte arrays allocated by P or  Q. SYield a pointer to the array''s data. This operation is only safe on  pinned byte arrays allocated by P or  Q. T8Check if the two arrays refer to the same memory block. UFConvert a mutable byte array to an immutable one without copying. The 4 array should not be modified after the conversion. VFConvert an immutable byte array to a mutable one without copying. The 9 original array should not be used after the conversion. WSize of the byte array. X Size of the mutable byte array. YCRead a primitive value from the byte array. The offset is given in  elements of type a rather than in bytes. ZCRead a primitive value from the byte array. The offset is given in  elements of type a rather than in bytes. [BWrite a primitive value to the byte array. The offset is given in  elements of type a rather than in bytes. \ACopy a slice of an immutable byte array to a mutable byte array. ]HCopy a slice of a mutable byte array into another array. The two slices  may not overlap. ^?Copy a slice of a mutable byte array into another, potentially  overlapping array. _3Fill a slice of a mutable byte array with a value. KLMNOPQRSTUVWXYZ[\destination array offset into destination array  source array offset into source array number of bytes to copy ]destination array offset into destination array  source array offset into source array number of bytes to copy ^destination array offset into destination array  source array offset into source array number of bytes to copy _array to fill offset into array number of bytes to fill value to fill with `abcŽKLMNOPQRSTUVWXYZ[\]^_`abcMNKLOPQZ[YUVWXTRS\]^_`abcKLMNOPQRSTUVWXYZ[\]^_`abcŽ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-Infered dThe null address e/Offset an address by the given number of bytes fIDistance in bytes between two addresses. The result is only valid if the  difference fits in an . g.The remainder of the address and the integer. hGRead a value from a memory position given by an address and an offset. L The memory block the address refers to must be immutable. The offset is in  elements of type a rather than in bytes. iGRead a value from a memory position given by an address and an offset. # The offset is in elements of type a rather than in bytes. jFWrite a value to a memory position given by an address and an offset. # The offset is in elements of type a rather than in bytes. k/Copy the given number of bytes from the second ; to the first. The  areas may not overlap. l/Copy the given number of bytes from the second ; to the first. The  areas may overlap. defghijkdestination address source address number of bytes ldestination address source address number of bytes m ;<defghijklm ;<defghijklm defghijklm non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> Safe-InferednSize of values of type a. The argument is not used. oAlignment of values of type a. The argument is not used. no@23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnonono non-portable&Justin Bonnar <justinbonnar@gmail.com> Safe-InferedpA p8 behaves like a single-element mutable array associated  with a primitive state token. r Create a new p" with the specified initial value sRead the value of a p tWrite a new value into a p uMutate the contents of a p pqrstu‘pqrstupqrstupqrstu‘’    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGGHHIIJKLMNOPQRSTTUUVWXYZ[\]^_`abcdefghijklmnopqrstuvwwxyz{|}~ €|‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™ š›œprimitive-0.4.1Data.Primitive.ByteArrayControl.Monad.PrimitiveData.Primitive.MachDepsData.Primitive.TypesData.Primitive.ArrayData.Primitive.AddrData.PrimitiveData.Primitive.MutVarData.Primitive.Internal.Compatghc-primGHC.Prim ByteArray#MutableByteArray# RealWorld sIZEOF_CHARaLIGNMENT_CHAR sIZEOF_INT aLIGNMENT_INT sIZEOF_WORDaLIGNMENT_WORD sIZEOF_DOUBLEaLIGNMENT_DOUBLE sIZEOF_FLOATaLIGNMENT_FLOAT sIZEOF_PTR aLIGNMENT_PTR sIZEOF_FUNPTRaLIGNMENT_FUNPTRsIZEOF_STABLEPTRaLIGNMENT_STABLEPTR sIZEOF_INT8aLIGNMENT_INT8 sIZEOF_WORD8aLIGNMENT_WORD8 sIZEOF_INT16aLIGNMENT_INT16 sIZEOF_WORD16aLIGNMENT_WORD16 sIZEOF_INT32aLIGNMENT_INT32 sIZEOF_WORD32aLIGNMENT_WORD32 sIZEOF_INT64aLIGNMENT_INT64 sIZEOF_WORD64aLIGNMENT_WORD64 PrimMonad PrimState primitiveinternal primitive_ primToPrimprimToIOprimToSTunsafePrimToPrimunsafePrimToSTunsafePrimToIOunsafeInlinePrimunsafeInlineIOunsafeInlineSTtouchPrimsizeOf# alignment#indexByteArray#readByteArray#writeByteArray# indexOffAddr# readOffAddr# writeOffAddr#Addr MutableArrayArraynewArray readArray writeArray indexArray indexArrayMunsafeFreezeArrayunsafeThawArraysameMutableArray copyArraycopyMutableArrayMutableByteArray ByteArray newByteArraynewPinnedByteArraynewAlignedPinnedByteArraybyteArrayContentsmutableByteArrayContentssameMutableByteArrayunsafeFreezeByteArrayunsafeThawByteArraysizeofByteArraysizeofMutableByteArrayindexByteArray readByteArraywriteByteArray copyByteArraycopyMutableByteArray moveByteArray fillByteArraymemcpyByteArraymemcpyByteArray'memmoveByteArraymemsetByteArraynullAddrplusAddr minusAddrremAddr indexOffAddr readOffAddr writeOffAddrcopyAddrmoveAddr memcpyAddrsizeOf alignmentMutVar newMutVar readMutVar writeMutVar modifyMutVarbase Data.Data mkNoRepType GHC.TypesIOGHC.STST $fPrimMonadST $fPrimMonadIO $fPrimAddr $fPrimChar $fPrimDouble $fPrimFloat $fPrimInt64 $fPrimInt32 $fPrimInt16 $fPrimInt8 $fPrimInt $fPrimWord64 $fPrimWord32 $fPrimWord16 $fPrimWord8 $fPrimWord $fDataAddr $fOrdAddr$fEqAddr$fDataMutableArray $fDataArray$fDataMutableByteArray$fDataByteArrayInt $fEqMutVar