!       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijkl m n o p q r s t u v w x y z { | } ~                                                  (c) Roman Leshchinskiy 2009 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone=>?@AFHVX< primitive PrimBase'os state token type can be annoying to handle in constraints. This typeclass lets users (visually) notice  2 equality constraints less, by witnessing that s ~   m.  primitive PrimMonad'os state token type can be annoying to handle in constraints. This typeclass lets users (visually) notice  2 equality constraints less, by witnessing that s ~   m.  primitive8Class of primitive monads for state-transformer actions.Unlike  #, this typeclass requires that the Monadp be fully expressed as a state transformer, therefore disallowing other monad transformers on top of the base IO or ST.  primitive*Expose the internal structure of the monad  primitiveEClass of monads which can perform primitive state-transformer actions  primitiveState token type primitiveExecute a primitive operation primitive,Execute a primitive operation with no result primitiveLifts a   into another  , with the same underlying state token type. primitive Convert a  , to another monad with the same state token. primitive Convert a   with a  state token to  primitive Convert a   to  primitive Convert an  action to a  . primitive Convert an  action to a  . primitive Convert a  Z to another monad with a possibly different state token. This operation is highly unsafe! primitive Convert any   to A with an arbitrary state token. This operation is highly unsafe! primitive Convert any   to ". This operation is highly unsafe! primitive Convert an - action with an arbitrary state token to any  #. This operation is highly unsafe! primitive Convert an  action to any  #. This operation is highly unsafe! primitiveSee 9. This function is not recommended for the same reasons. primitive8Generally, do not use this function. It is the same as accursedUnutterablePerformIO from  bytestring and is well behaved under narrow conditions. See the documentation of that function to get an idea of when this is sound. In most cases $GHC.IO.Unsafe.unsafeDupablePerformIO should be preferred. primitiveSee A. This function is not recommended for the same reasons. Prefer runST when s is free. primitive/Create an action to force a value; generalizes  ) primitive3 primitive7 primitive  !"  !"  (c) Roman Leshchinskiy 2011-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNoneF? (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone 2FHSVX; primitive=Mutable boxed arrays associated with a primitive state token.> primitive Boxed arraysC primitivecCreate a new mutable array of the specified size and initialise all elements with the given value.Note:; this function does not check if the input is non-negative.D primitive/Read a value from the array at the given index.Note:+ this function does not do bounds checking.E primitive.Write a value to the array at the given index.Note:+ this function does not do bounds checking.F primitive9Read a value from the immutable array at the given index.Note:+ this function does not do bounds checking.G primitiveRead a value from the immutable array at the given index, returning the result in an unboxed unary tuple. This is currently used to implement folds.Note:+ this function does not do bounds checking.H primitive Monadically read a value from the immutable array at the given index. This allows us to be strict in the array while remaining lazy in the read element which is very useful for collective operations. Suppose we want to copy an array. We could do something like this: ucopy marr arr ... = do ... writeArray marr i (indexArray arr i) ... ...2But since primitive arrays are lazy, the calls to F! will not be evaluated. Rather, marrG will be filled with thunks each of which would retain a reference to arr&. This is definitely not what we want!With H, we can instead write copy marr arr ... = do ... x <- indexArrayM arr i writeArray marr i x ...\Now, indexing is executed immediately although the returned element is still not evaluated.Note:+ this function does not do bounds checking.I primitive0Create an immutable copy of a slice of an array.sThis operation makes a copy of the specified section, so it is safe to continue using the mutable array afterward.J primitivetConvert a mutable array to an immutable one without copying. The array should not be modified after the conversion.K primitive:Create a mutable array from a slice of an immutable array.hThis operation makes a copy of the specified slice, so it is safe to use the immutable array afterward.L primitive{Convert an immutable array to an mutable one without copying. The immutable array should not be used after the conversion.M primitive<Check whether the two arrays refer to the same memory block.N primitive6Copy a slice of an immutable array to a mutable array.Note:6 this function does not do bounds or overlap checking.O primitiveCopy a slice of a mutable array to another array. The two arrays must not be the same when using this library with GHC versions 7.6 and older. In GHC 7.8 and newer, overlapping arrays will behave correctly.Note:2 The order of arguments is different from that of P. The primop has the source first while this wrapper has the destination first.Note:6 this function does not do bounds or overlap checking.P primitiveRReturn a newly allocated Array with the specified subrange of the provided Array.Note:i The provided Array should contain the full subrange specified by the two Ints, but this is not checked.Q primitiveReturn a newly allocated MutableArray. with the specified subrange of the provided MutableArray. The provided MutableArray should contain the full subrange specified by the two Ints, but this is not checked.Note:i The provided Array should contain the full subrange specified by the two Ints, but this is not checked.R primitive=Execute the monadic action(s) and freeze the resulting array.S primitiveThis is the fastest, most straightforward way to traverse an array, but it only works correctly with a sufficiently "affine"  D instance. In particular, it must only produce *one* result array. >-transformed monads, for example, will not work right at all.T primitive*Strict map over the elements of the array.U primitiveCreate an array from a list of a known length. If the length of the list does not match the given length, this throws an exception.V primitiveCreate an array from a list.X primitiveZ primitive] primitiveh primitivei primitiveALexicographic ordering. Subject to change between major versions.j primitiveI primitivesource primitiveoffset primitivelengthK primitivesource primitiveoffset primitivelengthN primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of elements to copyO primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of elements to copyP primitive source array primitiveoffset into destination array primitivenumber of elements to copyQ primitive source array primitiveoffset into destination array primitivenumber of elements to copy;<=>?@ABCDEFGHIJKLMNOPQRSTUV>?@;<=CDEFHGIKRJLMNOPQABUVTSBSD2 non-portableNoneF s primitive Create a new q that is initially empty.t primitive Create a new q" that holds the supplied argument.u primitiveReturn the contents of the q . If the q is currently empty, u& will wait until it is full. After a u, the q is left empty.v primitive#Atomically read the contents of an q . If the q is currently empty, v will wait until it is full. v# is guaranteed to receive the next w.Multiple Wakeup: vA is multiple-wakeup, so when multiple readers are blocked on an q,, all of them are woken up at the same time.Compatibility note: On GHCs prior to 7.8, v is a combination of u and w<. Consequently, its behavior differs in the following ways:/It is single-wakeup instead of multiple-wakeup.5It might not receive the value from the next call to w4 if there is already a pending thread blocked on u.&If another thread puts a value in the q in between the calls to u and w, that value may be overridden.w primitivePut a value into an q . If the q is currently full, w" will wait until it becomes empty.x primitiveA non-blocking version of u. The x% function returns immediately, with  if the q was empty, or  a if the q was full with contents a . After x, the q is left empty.y primitiveA non-blocking version of w. The y% function attempts to put the value a into the q , returning  if it was successful, or  otherwise.z primitiveA non-blocking version of v. The z% function returns immediately, with  if the q was empty, or  a if the q was full with contents a.Compatibility note: On GHCs prior to 7.8, z is a combination of x and w<. Consequently, its behavior differs in the following ways:/It is single-wakeup instead of multiple-wakeup.)In the presence of other threads calling w, z may block.&If another thread puts a value in the q in between the calls to x and w, that value may be overridden.{ primitiveCheck whether a given q is empty.Notice that the boolean value returned is just a snapshot of the state of the MVar. By the time you get to react on its result, the MVar may have been filled (or emptied) - so be extremely careful when using this operation. Use x instead if possible. qrstuvwxyz{ qrt{swvuyzx (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNoneF"}~"~} (c) Roman Leshchinskiy 2011-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone F4(c) Justin Bonnar 2011, Roman Leshchinskiy 2011-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone2F primitiveA V behaves like a single-element mutable array associated with a primitive state token. primitive Create a new ! with the specified initial value primitiveRead the value of a  primitiveWrite a new value into a  primitive$Atomically mutate the contents of a  primitiveStrict version of ,. This forces both the value stored in the  as well as the value returned. primitiveMutate the contents of a  primitiveStrict version of  (c) 2015 Dan DoelBSD3libraries@haskell.org non-portableNone2456FHMSVX primitive!Create a new small mutable array.Note:; this function does not check if the input is non-negative. primitive5Read the element at a given index in a mutable array.Note:+ this function does not do bounds checking. primitive6Write an element at the given idex in a mutable array.Note:+ this function does not do bounds checking. primitive)Look up an element in an immutable array.7The purpose of returning a result using a monad is to allow the caller to avoid retaining references to the array. Evaluating the return value will cause the array lookup to be performed, even though it may not require the element of the array to be evaluated (which could throw an exception). For instance: Kdata Box a = Box a ... f sa = case indexSmallArrayM sa 0 of Box x -> ...x" is not a closure that references sa% as it would be if we instead wrote: let x = indexSmallArray sa 0And does not prevent sa from being garbage collected. Note that k is not adequate for this use, as it is a newtype, and cannot be evaluated without evaluating the element.Note:+ this function does not do bounds checking. primitive)Look up an element in an immutable array.Note:+ this function does not do bounds checking. primitiveRead a value from the immutable array at the given index, returning the result in an unboxed unary tuple. This is currently used to implement folds. primitive/Create a copy of a slice of an immutable array.Note:i The provided Array should contain the full subrange specified by the two Ints, but this is not checked. primitive,Create a copy of a slice of a mutable array.Note:i The provided Array should contain the full subrange specified by the two Ints, but this is not checked. primitiveFCreate an immutable array corresponding to a slice of a mutable array.<This operation copies the portion of the array to be frozen. primitive!Render a mutable array immutable.hThis operation performs no copying, so care must be taken not to modify the input array after freezing. primitiveFCreate a mutable array corresponding to a slice of an immutable array.<This operation copies the portion of the array to be thawed. primitive"Render an immutable array mutable.GThis operation performs no copying, so care must be taken with its use. primitive8Copy a slice of an immutable array into a mutable array.Note:6 this function does not do bounds or overlap checking. primitive/Copy a slice of one mutable array into another.Note:6 this function does not do bounds or overlap checking. primitiveThis is the fastest, most straightforward way to traverse an array, but it only works correctly with a sufficiently "affine"  D instance. In particular, it must only produce *one* result array. >-transformed monads, for example, will not work right at all. primitive*Strict map over the elements of the array. primitive Create a w from a list of a known length. If the length of the list does not match the given length, this throws an exception. primitive Create a  from a list. primitive primitive primitive primitiveALexicographic ordering. Subject to change between major versions. primitive primitive  primitivesize primitiveinitial contents primitivearray primitiveindex primitivearray primitiveindex primitive new element primitivearray primitiveindex primitivearray primitiveindex primitivesource primitiveoffset primitivelength primitivesource primitiveoffset primitivelength primitivesource primitiveoffset primitivelength primitivesource primitiveoffset primitivelength primitive destination primitivedestination offset primitivesource primitive source offset primitivelength primitive destination primitivedestination offset primitivesource primitive source offset primitivelength1 (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone -.127FHMX=~ primitiveNewtype that uses a  instance to give rise to a 6 instance. This type is intended to be used with the  DerivingViaN extension available in GHC 8.6 and up. For example, consider a user-defined & instance for a multi-word data type. gdata Uuid = Uuid Word64 Word64 deriving Storable via (PrimStorable Uuid) instance Prim Uuid where ... Writing the . instance is tedious and unavoidable, but the # instance comes for free once the  instance is written. primitiveClass of types supporting primitive array operations. This includes interfacing with GC-managed memory (functions suffixed with  ByteArray#B) and interfacing with unmanaged memory (functions suffixed with Addr#%). Endianness is platform-dependent. primitiveSize of values of type a. The argument is not used. primitiveAlignment of values of type a. The argument is not used. primitive@Read a value from the array. The offset is in elements of type a rather than in bytes. primitiveHRead a value from the mutable array. The offset is in elements of type a rather than in bytes. primitiveGWrite a value to the mutable array. The offset is in elements of type a rather than in bytes. primitivelFill a slice of the mutable array with a value. The offset and length of the chunk are in elements of type a rather than in bytes. primitiveRead a value from a memory position given by an address and an offset. The memory block the address refers to must be immutable. The offset is in elements of type a rather than in bytes. primitivejRead 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. primitiveiWrite 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. primitivepFill a memory block given by an address, an offset and a length. The offset and length are in elements of type a rather than in bytes. primitiveSize of values of type a. The argument is not used.8This function has existed since 0.1, but was moved from  to  in version 0.6.3.0 primitiveAlignment of values of type a. The argument is not used.8This function has existed since 0.1, but was moved from  to  in version 0.6.3.0 primitiveAn implementation of  that calls 6 to set each element. This is helpful when writing a  instance for a multi-word data type for which there is no cpu-accelerated way to broadcast a value to contiguous memory. It is typically used alongside . For example: Hdata Trip = Trip Int Int Int instance Prim Trip sizeOf# _ = 3# *# sizeOf# (undefined :: Int) alignment# _ = alignment# (undefined :: Int) indexByteArray# arr# i# = ... readByteArray# arr# i# = ... writeByteArray# arr# i# (Trip a b c) = \s0 -> case writeByteArray# arr# (3# *# i#) a s0 of s1 -> case writeByteArray# arr# ((3# *# i#) +# 1#) b s1 of s2 -> case writeByteArray# arr# ((3# *# i#) +# 2# ) c s2 of s3 -> s3 setByteArray# = defaultSetByteArray# indexOffAddr# addr# i# = ... readOffAddr# addr# i# = ... writeOffAddr# addr# i# (Trip a b c) = \s0 -> case writeOffAddr# addr# (3# *# i#) a s0 of s1 -> case writeOffAddr# addr# ((3# *# i#) +# 1#) b s1 of s2 -> case writeOffAddr# addr# ((3# *# i#) +# 2# ) c s2 of s3 -> s3 setOffAddr# = defaultSetOffAddr# primitiveAn implementation of  that calls , to set each element. The documentation of ) provides an example of how to use this. primitive primitive primitive primitive primitive primitive primitive primitive primitive primitive  primitive  primitive (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone  2FHSVX(; primitive;Mutable byte arrays associated with a primitive state token= primitive Byte arrays? primitive?Create a new mutable byte array of the specified size in bytes.Note:; this function does not check if the input is non-negative.@ primitive Create a pinned` byte array of the specified size in bytes. The garbage collector is guaranteed not to move it.Note:; this function does not check if the input is non-negative.A primitive Create a pinned} byte array of the specified size in bytes and with the given alignment. The garbage collector is guaranteed not to move it.Note:; this function does not check if the input is non-negative.B primitiveEYield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by @ or A.C primitiveEYield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by @ or A.D primitive7Check if the two arrays refer to the same memory block.E primitive<Resize a mutable byte array. The new size is given in bytes.This will either resize the array in-place or, if not possible, allocate the contents into a new, unpinned array and copy the original array's contents.+To avoid undefined behaviour, the original ;( shall not be accessed anymore after a E has been performed. Moreover, no reference to the old one should be kept in order to allow garbage collection of the original ; in case a new ; had to be allocated.F primitive.Get the size of a byte array in bytes. Unlike K@, this function ensures sequencing in the presence of resizing.G primitive_Create an immutable copy of a slice of a byte array. The offset and length are given in bytes.sThis operation makes a copy of the specified section, so it is safe to continue using the mutable array afterward.H primitiveyConvert a mutable byte array to an immutable one without copying. The array should not be modified after the conversion.I primitive~Convert an immutable byte array to a mutable one without copying. The original array should not be used after the conversion.J primitive Size of the byte array in bytes.K primitiveSSize of the mutable byte array in bytes. This function's behavior is undefined if E} is ever called on the mutable byte array given as the argument. Consequently, use of this function is discouraged. Prefer F@, which ensures correct sequencing in the presence of resizing.L primitiveShrink a mutable byte array. The new size is given in bytes. It must be smaller than the old size. The array will be resized in place. This function is only available when compiling with GHC 7.10 or newer.M primitiveCheck whether or not the byte array is pinned. Pinned byte arrays cannot be moved by the garbage collector. It is safe to use Ba on such byte arrays. This function is only available when compiling with GHC 8.2 or newer.N primitiveCheck whether or not the mutable byte array is pinned. This function is only available when compiling with GHC 8.2 or newer.O primitiveURead a primitive value from the byte array. The offset is given in elements of type a rather than in bytes.Note:+ this function does not do bounds checking.P primitiveURead a primitive value from the byte array. The offset is given in elements of type a rather than in bytes.Note:+ this function does not do bounds checking.Q primitiveTWrite a primitive value to the byte array. The offset is given in elements of type a rather than in bytes.Note:+ this function does not do bounds checking.R primitive"Right-fold over the elements of a =.S primitive Create a = from a list. byteArrayFromList xs = T (length xs) xsT primitive Create a =w from a list of a known length. If the length of the list does not match the given length, this throws an exception.U primitive@Copy a slice of an immutable byte array to a mutable byte array.Note:6 this function does not do bounds or overlap checking.V primitiveYCopy a slice of a mutable byte array into another array. The two slices may not overlap.Note:6 this function does not do bounds or overlap checking.W primitiveCopy a slice of a byte array to an unmanaged Pointer Address. These must not overlap. The offset and length given in elements, not in bytes. This function is only available when compiling with GHC 7.8 or newer.Note:6 this function does not do bounds or overlap checking.X primitiveCopy a slice of a mutable byte array to an unmanaged Pointer address. These must not overlap. The offset and length given in elements, not in bytes. This function is only available when compiling with GHC 7.8 or newer.Note:6 this function does not do bounds or overlap checking.Y primitiveCopy a slice of a byte array to an unmanaged address. These must not overlap. This function is only available when compiling with GHC 7.8 or newer.Note: This function is just W where a is .Z primitiveCopy a slice of a mutable byte array to an unmanaged address. These must not overlap. This function is only available when compiling with GHC 7.8 or newer.Note: This function is just X where a is .[ primitiveRCopy a slice of a mutable byte array into another, potentially overlapping array.\ primitivehFill a slice of a mutable byte array with a value. The offset and length are given in elements of type a rather than in bytes.Note:+ this function does not do bounds checking.] primitive1Fill a slice of a mutable byte array with a byte.Note:+ this function does not do bounds checking.^ primitiveVLexicographic comparison of equal-length slices into two byte arrays. This wraps the compareByteArrays# primop, which wraps memcmp._ primitiveReturn a newly allocated array with the specified subrange of the provided array. The provided array should contain the full subrange specified by the two Ints, but this is not checked.` primitiveReturn a newly allocated mutable array with the specified subrange of the provided mutable array. The provided mutable array should contain the full subrange specified by the two Ints, but this is not checked.a primitived primitiveNon-lexicographic ordering. This compares the lengths of the byte arrays first and uses a lexicographic ordering if the lengths are equal. Subject to change between major versions.e primitivef primitiveA primitivesize primitive alignmentG primitivesource primitiveoffset in bytes primitivelength in bytesL primitivenew sizeU primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of bytes to copyV primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of bytes to copyW primitive destination primitive source array primitive:offset into source array, interpreted as elements of type a primitivenumber of elements to copyX primitive destination primitive source array primitive:offset into source array, interpreted as elements of type a primitivenumber of elements to copyY primitive destination primitive source array primitiveoffset into source array primitivenumber of bytes to copyZ primitive destination primitive source array primitiveoffset into source array primitivenumber of bytes to copy[ primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of bytes to copy\ primitive array to fill primitiveoffset into array primitivenumber of values to fill primitivevalue to fill with] primitive array to fill primitiveoffset into array primitivenumber of bytes to fill primitivebyte to fill with^ primitiveArray A primitiveOffset A, given in bytes primitiveArray B primitiveOffset B, given in bytes primitiveLength of slice, given in bytes_ primitive source array primitiveoffset into destination array primitivenumber of bytes to copy` primitive source array primitiveoffset into destination array primitivenumber of bytes to copy(;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`(=>;<?@AELPQOSTR^GHIUVWXYZ[\]_`JKFDMNBC  (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNone FHSVXuU?l primitiveMutable primitive arrays associated with a primitive state token. These can be written to and read from in a monadic context that supports sequencing such as  or n. Typically, a mutable primitive array will be built and then convert to an immutable primitive array using . However, it is also acceptable to simply discard a mutable primitive array since it lives in managed memory and will be garbage collected when no longer referenced.n primitive4Arrays of unboxed elements. This accepts types like , , , and *, as well as their fixed-length variants (Word8, Word16+, etc.). Since the elements are unboxed, a n? is strict in its elements. This differs from the behavior of Array!, which is lazy in its elements.p primitive Create a n from a list. primArrayFromList vs = byteArrayFromListN (length vs) vsq primitive Create a nw from a list of a known length. If the length of the list does not match the given length, this throws an exception.r primitive&Convert the primitive array to a list. primitiveThe empty primitive array.s primitivegCreate a new mutable primitive array of the given length. The underlying memory is left uninitialized.Note:; this function does not check if the input is non-negative.t primitiveDResize a mutable primitive array. The new size is given in elements.This will either resize the array in-place or, if not possible, allocate the contents into a new, unpinned array and copy the original array's contents.+To avoid undefined behaviour, the original l( shall not be accessed anymore after a t has been performed. Moreover, no reference to the old one should be kept in order to allow garbage collection of the original l in case a new l had to be allocated.u primitiveShrink a mutable primitive array. The new size is given in elements. It must be smaller than the old size. The array will be resized in place. This function is only available when compiling with GHC 7.10 or newer.v primitive/Read a value from the array at the given index.Note:+ this function does not do bounds checking.w primitive$Write an element to the given index.Note:+ this function does not do bounds checking.x primitiveCopy part of a mutable array into another mutable array. In the case that the destination and source arrays are the same, the regions may overlap.Note:6 this function does not do bounds or overlap checking.y primitive1Copy part of an array into another mutable array.Note:6 this function does not do bounds or overlap checking.z primitivesCopy a slice of an immutable primitive array to an address. The offset and length are given in elements of type a$. This function assumes that the  instance of a agrees with the StorableR instance. This function is only available when building with GHC 7.8 or newer.Note:6 this function does not do bounds or overlap checking.{ primitivesCopy a slice of an immutable primitive array to an address. The offset and length are given in elements of type a$. This function assumes that the  instance of a agrees with the StorableR instance. This function is only available when building with GHC 7.8 or newer.Note:6 this function does not do bounds or overlap checking.| primitive7Fill a slice of a mutable primitive array with a value.Note:+ this function does not do bounds checking.} primitive>Get the size of a mutable primitive array in elements. Unlike ~@, this function ensures sequencing in the presence of resizing.~ primitiveSize of the mutable primitive array in elements. This function shall not be used on primitive arrays that are an argument to or a result of t or u. primitive7Check if the two arrays refer to the same memory block. primitivegCreate an immutable copy of a slice of a primitive array. The offset and length are given in elements.sThis operation makes a copy of the specified section, so it is safe to continue using the mutable array afterward. primitiveyConvert a mutable byte array to an immutable one without copying. The array should not be modified after the conversion. primitiveyConvert an immutable array to a mutable one without copying. The original array should not be used after the conversion. primitive0Read a primitive value from the primitive array.Note:+ this function does not do bounds checking. primitive2Get the size, in elements, of the primitive array. primitiveCheck whether or not the byte array is pinned. Pinned primitive arrays cannot be moved by the garbage collector. It is safe to use a on such byte arrays. This function is only available when compiling with GHC 8.2 or newer. primitiveCheck whether or not the mutable primitive array is pinned. This function is only available when compiling with GHC 8.2 or newer. primitive2Lazy right-associated fold over the elements of a n. primitive4Strict right-associated fold over the elements of a n. primitive1Lazy left-associated fold over the elements of a n. primitive3Strict left-associated fold over the elements of a n. primitive3Strict left-associated fold over the elements of a n. primitiveTraverse a primitive array. The traversal forces the resulting values and writes them to the new primitive array as it performs the monadic effects. Consequently:[traversePrimArrayP (\x -> print x $> bool x undefined (x == 2)) (fromList [1, 2, 3 :: Int])12 *** Exception: Prelude.undefinedIn many situations,  can replace , changing the strictness characteristics of the traversal but typically improving the performance. Consider the following short-circuiting traversal: incrPositiveA :: PrimArray Int -> Maybe (PrimArray Int) incrPositiveA xs = traversePrimArray (\x -> bool Nothing (Just (x + 1)) (x > 0)) xsThis can be rewritten using 7. To do this, we must change the traversal context to  MaybeT (ST s), which has a   instance: incrPositiveB :: PrimArray Int -> Maybe (PrimArray Int) incrPositiveB xs = runST $ runMaybeT $ traversePrimArrayP (\x -> bool (MaybeT (return Nothing)) (MaybeT (return (Just (x + 1)))) (x > 0)) xsBenchmarks demonstrate that the second implementation runs 150 times faster than the first. It also results in fewer allocations. primitiveaFilter the primitive array, keeping the elements for which the monadic predicate evaluates true. primitive_Map over the primitive array, keeping the elements for which the monadic predicate provides a . primitiveWGenerate a primitive array by evaluating the monadic generator function at each index. primitiveaExecute the monadic action the given number of times and store the results in a primitive array. primitive+Map over the elements of a primitive array. primitive3Indexed map over the elements of a primitive array. primitive>Filter elements of a primitive array according to a predicate. primitiveaFilter the primitive array, keeping the elements for which the monadic predicate evaluates true. primitivecMap over the primitive array, keeping the elements for which the applicative predicate provides a . primitivebMap over a primitive array, optionally discarding some elements. This has the same behavior as Data.Maybe.mapMaybe. primitiveSTraverse a primitive array. The traversal performs all of the applicative effects beforeY forcing the resulting values and writing them to the new primitive array. Consequently:ZtraversePrimArray (\x -> print x $> bool x undefined (x == 2)) (fromList [1, 2, 3 :: Int])123 *** Exception: Prelude.undefined The function 6 always outperforms this function, but it requires a  B constraint, and it forces the values as it performs the effects. primitive:Traverse a primitive array with the index of each element. primitiveTraverse a primitive array with the indices. The traversal forces the resulting values and writes them to the new primitive array as it performs the monadic effects. primitiveGenerate a primitive array. primitiveKCreate a primitive array by copying the element the given number of times. primitive[Generate a primitive array by evaluating the applicative generator function at each index. primitive\Execute the applicative action the given number of times and store the results in a vector. primitiveCTraverse the primitive array, discarding the results. There is no  N variant of this function since it would not provide any performance benefit. primitiveTTraverse the primitive array with the indices, discarding the results. There is no  N variant of this function since it would not provide any performance benefit. primitive Create a pinnedh primitive array of the specified size in elements. The garbage collector is guaranteed not to move it. primitive Create a pinnedX primitive array of the specified size in elements and with the alignment given by its ? instance. The garbage collector is guaranteed not to move it. primitiveEYield a pointer to the array's data. This operation is only safe on pinned prim arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray. primitiveEYield a pointer to the array's data. This operation is only safe on pinned byte arrays allocated by newPinnedByteArray or newAlignedPinnedByteArray. primitiveReturn a newly allocated array with the specified subrange of the provided array. The provided array should contain the full subrange specified by the two Ints, but this is not checked. primitiveReturn a newly allocated mutable array with the specified subrange of the provided mutable array. The provided mutable array should contain the full subrange specified by the two Ints, but this is not checked. primitive primitive primitive primitive primitiveALexicographic ordering. Subject to change between major versions. primitivet primitivenew sizeu primitivenew sizew primitivearray primitiveindex primitiveelementx primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of elements to copyy primitivedestination array primitiveoffset into destination array primitive source array primitiveoffset into source array primitivenumber of elements to copyz primitivedestination pointer primitive source array primitiveoffset into source array primitivenumber of prims to copy{ primitivedestination pointer primitive source array primitiveoffset into source array primitivenumber of prims to copy| primitive array to fill primitiveoffset into array primitivenumber of values to fill primitivevalue to fill with} primitivearray primitivesource primitiveoffset in elements primitivelength in elements primitivelength primitive generator primitivemapping function primitiveprimitive array primitivemapping function primitiveprimitive array primitivemapping function primitiveprimitive array primitivelength primitiveelement from index primitivelength primitiveelement primitivelength primitiveelement from index primitivelength primitiveapplicative element producer primitive source array primitiveoffset into destination array primitivenumber of elements to copy primitive source array primitiveoffset into destination array primitivenumber of elements to copy:lmnopqrstuvwxyz{|}~:nolmstuvwyxz{|}~rpq (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNoneFX*  primitive1Offset a pointer by the given number of elements. primitiveaSubtract a pointer from another pointer. The result represents the number of elements of type aJ that fit in the contiguous memory range bounded by these two pointers. primitiveRead a value from a memory position given by a pointer and an offset. The memory block the address refers to must be immutable. The offset is in elements of type a rather than in bytes. primitivejRead 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. primitiveiWrite 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. primitive2Copy the given number of elements from the second * to the first. The areas may not overlap. primitive2Copy the given number of elements from the second & to the first. The areas may overlap. primitiveMFill a memory block with the given value. The length is in elements of type a rather than in bytes. primitivegCopy from a pointer to a mutable primitive array. The offset and length are given in elements of type aH. This function is only available when building with GHC 7.8 or newer. primitivebCopy from a pointer to a mutable byte array. The offset and length are given in elements of type aH. This function is only available when building with GHC 7.8 or newer. primitivedestination pointer primitivesource pointer primitivenumber of elements primitivedestination address primitivesource address primitivenumber of elements primitivedestination array primitivedestination offset primitivesource pointer primitivenumber of elements primitivedestination array primitive-destination offset given in elements of type a primitivesource pointer primitivenumber of elements   (c) Roman Leshchinskiy 2009-2012 BSD-style'Roman Leshchinskiy <rl@cse.unsw.edu.au> non-portableNoneFD;<=>?@ABCDEFGHIJKLMNOPQRSTUV;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`lmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTTUVVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~           !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMMNNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ | | } } ~                                                                (primitive-0.7.1.0-6Ng9GYhvLyE4pBQRYaGxSxData.Primitive.ArrayData.Primitive.ByteArrayControl.Monad.PrimitiveData.Primitive.TypesData.Primitive.PtrData.Primitive.MVarData.Primitive.MachDepsData.Primitive.MutVarData.Primitive.SmallArrayData.Primitive.PrimArrayControl.ExceptionevaluateData.Primitive.Internal.CompatControl.Monad.Trans.ListListT"Data.Primitive.Internal.OperationsData PrimitiveData.PrimitiveTypesbaseGHC.ExtsfromList fromListNghc-primGHC.Prim ByteArray#MutableByteArray# RealWorldGHC.PtrPtrnullPtr MonadPrimBase MonadPrimPrimBaseinternal PrimMonad PrimState primitive primitive_liftPrim primToPrimprimToIOprimToSTioToPrimstToPrimunsafePrimToPrimunsafePrimToSTunsafePrimToIOunsafeSTToPrimunsafeIOToPrimunsafeInlinePrimunsafeInlineIOunsafeInlineSTtouchevalPrim noDuplicateunsafeInterleaveunsafeDupableInterleave $fPrimMonadST$fPrimMonadST0$fPrimMonadRWST$fPrimMonadWriterT$fPrimMonadStateT$fPrimMonadSelectT$fPrimMonadAccumT$fPrimMonadExceptT$fPrimMonadRWST0$fPrimMonadWriterT0$fPrimMonadStateT0$fPrimMonadReaderT$fPrimMonadErrorT$fPrimMonadMaybeT$fPrimMonadListT$fPrimMonadIdentityT$fPrimMonadContT $fPrimMonadIO $fPrimBaseST $fPrimBaseST0$fPrimBaseIdentityT $fPrimBaseIO $fMonadPrimsm$fMonadPrimBasesm MutableArraymarray#Arrayarray# sizeofArraysizeofMutableArraynewArray readArray writeArray indexArray indexArray## indexArrayM freezeArrayunsafeFreezeArray thawArrayunsafeThawArraysameMutableArray copyArraycopyMutableArray cloneArraycloneMutableArrayrunArraytraverseArrayP mapArray'arrayFromListN arrayFromList $fDataArray $fRead1Array $fReadArray $fShow1Array $fShowArray $fMonoidArray$fSemigroupArray$fMonadFixArray$fMonadZipArray$fMonadPlusArray$fMonadFailArray$fAlternativeArray$fApplicativeArray$fFunctorArray $fIsListArray$fTraversableArray$fFoldableArray $fOrd1Array $fOrdArray $fEq1Array $fEqArray $fNFDataArray$fNFData1Array$fDataMutableArray$fEqMutableArray $fMonadArrayMVar newEmptyMVarnewMVartakeMVarreadMVarputMVar tryTakeMVar tryPutMVar tryReadMVar isEmptyMVar$fEqMVarInt64_#Word64_# 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_WORD64MutVar newMutVar readMutVar writeMutVaratomicModifyMutVaratomicModifyMutVar' modifyMutVar modifyMutVar' $fEqMutVarSmallMutableArray SmallArray newSmallArrayreadSmallArraywriteSmallArrayindexSmallArrayMindexSmallArrayindexSmallArray##cloneSmallArraycloneSmallMutableArrayfreezeSmallArrayunsafeFreezeSmallArraythawSmallArrayunsafeThawSmallArraycopySmallArraycopySmallMutableArraysizeofSmallArraysizeofSmallMutableArraytraverseSmallArrayPmapSmallArray' runSmallArraysmallArrayFromListNsmallArrayFromList$fDataSmallArray$fRead1SmallArray$fReadSmallArray$fShow1SmallArray$fShowSmallArray$fIsListSmallArray$fMonoidSmallArray$fSemigroupSmallArray$fMonadFixSmallArray$fMonadZipSmallArray$fMonadPlusSmallArray$fMonadFailSmallArray$fAlternativeSmallArray$fApplicativeSmallArray$fFunctorSmallArray$fTraversableSmallArray$fFoldableSmallArray$fOrdSmallArray$fOrd1SmallArray$fEqSmallArray$fEq1SmallArray$fNFDataSmallArray$fNFData1SmallArray$fDataSmallMutableArray$fEqSmallMutableArray$fMonadSmallArray PrimStorablegetPrimStorablePrimsizeOf# alignment#indexByteArray#readByteArray#writeByteArray# setByteArray# indexOffAddr# readOffAddr# writeOffAddr# setOffAddr#sizeOf alignmentdefaultSetByteArray#defaultSetOffAddr# $fPrimIntPtr $fPrimWordPtr $fPrimFunPtr$fPrimStablePtr $fPrimPtr $fPrimChar $fPrimDouble $fPrimFloat $fPrimInt64 $fPrimInt32 $fPrimInt16 $fPrimInt8 $fPrimInt $fPrimWord64 $fPrimWord32 $fPrimWord16 $fPrimWord8 $fPrimWord$fStorablePrimStorable $fPrimMax $fPrimMin $fPrimLast $fPrimFirst $fPrimProduct $fPrimSum $fPrimDual$fPrimIdentity $fPrimDown $fPrimConst$fPrimFd $fPrimCTimer $fPrimCKey $fPrimCId$fPrimCFsFilCnt$fPrimCFsBlkCnt$fPrimCClockId $fPrimCBlkCnt$fPrimCBlkSize $fPrimCRLim $fPrimCTcflag $fPrimCSpeed $fPrimCCc $fPrimCUid $fPrimCNlink $fPrimCGid $fPrimCSsize $fPrimCPid $fPrimCOff $fPrimCMode $fPrimCIno $fPrimCDev $fPrimCDouble $fPrimCFloat$fPrimCSUSeconds$fPrimCUSeconds $fPrimCTime $fPrimCClock$fPrimCUIntMax $fPrimCIntMax$fPrimCUIntPtr $fPrimCIntPtr $fPrimCBool $fPrimCULLong $fPrimCLLong$fPrimCSigAtomic $fPrimCWchar $fPrimCSize$fPrimCPtrdiff $fPrimCULong $fPrimCLong $fPrimCUInt $fPrimCInt $fPrimCUShort $fPrimCShort $fPrimCUChar $fPrimCSChar $fPrimCCharMutableByteArray ByteArray newByteArraynewPinnedByteArraynewAlignedPinnedByteArraybyteArrayContentsmutableByteArrayContentssameMutableByteArrayresizeMutableByteArraygetSizeofMutableByteArrayfreezeByteArrayunsafeFreezeByteArrayunsafeThawByteArraysizeofByteArraysizeofMutableByteArrayshrinkMutableByteArrayisByteArrayPinnedisMutableByteArrayPinnedindexByteArray readByteArraywriteByteArrayfoldrByteArraybyteArrayFromListbyteArrayFromListN copyByteArraycopyMutableByteArraycopyByteArrayToPtrcopyMutableByteArrayToPtrcopyByteArrayToAddrcopyMutableByteArrayToAddr moveByteArray setByteArray fillByteArraycompareByteArrayscloneByteArraycloneMutableByteArray$fIsListByteArray$fMonoidByteArray$fSemigroupByteArray$fOrdByteArray $fEqByteArray$fShowByteArray$fDataByteArray$fNFDataByteArray$fDataMutableByteArray$fEqMutableByteArray$fNFDataMutableByteArrayMutablePrimArray PrimArrayprimArrayFromListprimArrayFromListNprimArrayToList newPrimArrayresizeMutablePrimArrayshrinkMutablePrimArray readPrimArraywritePrimArraycopyMutablePrimArray copyPrimArraycopyPrimArrayToPtrcopyMutablePrimArrayToPtr setPrimArraygetSizeofMutablePrimArraysizeofMutablePrimArraysameMutablePrimArrayfreezePrimArrayunsafeFreezePrimArrayunsafeThawPrimArrayindexPrimArraysizeofPrimArrayisPrimArrayPinnedisMutablePrimArrayPinnedfoldrPrimArrayfoldrPrimArray'foldlPrimArrayfoldlPrimArray'foldlPrimArrayM'traversePrimArrayPfilterPrimArrayPmapMaybePrimArrayPgeneratePrimArrayPreplicatePrimArrayP mapPrimArray imapPrimArrayfilterPrimArrayfilterPrimArrayAmapMaybePrimArrayAmapMaybePrimArraytraversePrimArrayitraversePrimArrayitraversePrimArrayPgeneratePrimArrayreplicatePrimArraygeneratePrimArrayAreplicatePrimArrayAtraversePrimArray_itraversePrimArray_newPinnedPrimArraynewAlignedPinnedPrimArrayprimArrayContentsmutablePrimArrayContentsclonePrimArraycloneMutablePrimArray$fMonoidPrimArray$fSemigroupPrimArray$fShowPrimArray$fIsListPrimArray$fOrdPrimArray $fEqPrimArray$fNFDataPrimArray$fNFDataMutablePrimArray$fEqMutablePrimArray advancePtr subtractPtr indexOffPtr readOffPtr writeOffPtrcopyPtrmovePtrsetPtrcopyPtrToMutablePrimArraycopyPtrToMutableByteArray GHC.TypesIOGHC.STSTisTrue#copyMutableArray# GHC.MaybeNothingJustTrueFalsesetWideCharOffAddr#setDoubleOffAddr#setFloatOffAddr#setStablePtrOffAddr#setAddrOffAddr#setIntOffAddr#setInt64OffAddr#setInt32OffAddr#setInt16OffAddr#setInt8OffAddr#setWordOffAddr#setWord64OffAddr#setWord32OffAddr#setWord16OffAddr#setWord8OffAddr#setWideCharArray#setDoubleArray#setFloatArray#setStablePtrArray# setAddrArray# setIntArray#setInt64Array#setInt32Array#setInt16Array# setInt8Array# setWordArray#setWord64Array#setWord32Array#setWord16Array#setWord8Array#Data.Functor.IdentityIdentity?Foreign.StorableStorableGHC.WordWord8DoubleCharIntWordemptyPrimArray