úÎbN]f[      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au>           non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> !,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 [\ ( Convert a ! to ] ) Convert a !2 to another monad with a possibly different state ) token. This operation is highly unsafe! * Convert any ! to ]% with an arbitrary state token. This  operations is highly unsafe! + Convert any ! to [\#. This operation is highly unsafe! !"#$%&'()*+ !"#$%&'()+* !"#$"#$%&'()*+ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> ,5Class of types supporting primitive array operations -Size of values of type a. The argument is not used. .Alignment of values of type a. The argument is not used. /?Read a value from the array. The offset is in elements of type  a rather than in bytes. 0GRead a value from the mutable array. The offset is in elements of type  a rather than in bytes. 1FWrite a value to the mutable array. The offset is in elements of type  a rather than in bytes. 2GRead 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. 3GRead 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. 4FWrite 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. 5A machine address 6^ ,-./0123456 ,-./0123456 ,-./01234-./01234566 non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au> 7>Mutable boxed arrays associated with a primitive state token. 89 Boxed arrays :;DCreate a new mutable array of the specified size and initialise all  elements with the given value. <0Read a value from the array at the given index. =/Write a value to the array at the given index. >:Read a value from the immutable array at the given index. ?FMonadically 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 > 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 ?, 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. @AConvert a mutable array to an immutable one without copying. The 4 array should not be modified after the conversion. ABConvert an immutable array to an mutable one without copying. The : immutable array should not be used after the conversion. B=Check whether the two arrays refer to the same memory block. 789:;<=>?@AB 9:78;<=>?@AB 7889::;<=>?@AB non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au>C<Mutable byte arrays associated with a primitive state token DE Byte arrays FG7Create a new mutable byte array of the specified size. H Create a pinned9 byte array of the specified size. The garbage collector  is guaranteed not to move it. I Create a pinned4 byte array of the specified size and with the give @ alignment. The garbage collector is guaranteed not to move it. JYield a pointer to the array''s data. This operation is only safe on  pinned byte arrays allocated by H or  I. K8Check if the two arrays refer to the same memory block. LFConvert a mutable byte array to an immutable one without copying. The 4 array should not be modified after the conversion. MSize of the byte array. N Size of the mutable byte array. OCRead a primitive value from the byte array. The offset is given in  elements of type a rather than in bytes. PCRead a primitive value from the byte array. The offset is given in  elements of type a rather than in bytes. QBWrite a primitive value to the byte array. The offset is given in  elements of type a rather than in bytes. CDEFGHIJKLMNOPQEFCDGHIPQOLMNKJCDDEFFGHIJKLMNOPQ non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au>RThe null address S/Offset an address by the given number of bytes TIDistance in bytes between two addresses. The result is only valid if the  difference fits in an _. UVGRead 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. WGRead 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. XFWrite 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. 56RSTUVWX 56RSTUVWXRSTUVWX non-portable'Roman Leshchinskiy <rl@cse.unsw.edu.au>YSize of values of type a. The argument is not used. ZAlignment of values of type a. The argument is not used. /,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZYZYZ`      !"#$%&'()*+,-./0123456789:;<=>??@@AABCDEFGHIJJKKLMNOPQRSTUVWXYZ[\]^_`a`abcde`fg primitive-0.2Control.Monad.PrimitiveData.Primitive.MachDepsData.Primitive.TypesData.Primitive.ArrayData.Primitive.ByteArrayData.Primitive.AddrData.Primitiveghc-primGHC.Prim 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_ primToPrimprimToIOprimToSTunsafePrimToPrimunsafePrimToSTunsafePrimToIOPrimsizeOf# alignment#indexByteArray#readByteArray#writeByteArray# indexOffAddr# readOffAddr# writeOffAddr#Addr MutableArrayArraynewArray readArray writeArray indexArray indexArrayMunsafeFreezeArrayunsafeThawArraysameMutableArrayMutableByteArray ByteArray newByteArraynewPinnedByteArraynewAlignedPinnedByteArraybyteArrayContentssameMutableByteArrayunsafeFreezeByteArraysizeofByteArraysizeofMutableByteArrayindexByteArray readByteArraywriteByteArraynullAddrplusAddr minusAddrremAddr indexOffAddr readOffAddr writeOffAddrsizeOf alignment GHC.TypesIObaseGHC.STSTunI#Int