úÎxÛuî(      !"#$%&'None 2;'When performing compare-and-swaps, the ticketž encapsulates proof that a thread observed a specific previous value of a mutable variable. It is provided in lieu of the "old" value to compare-and-swap. Design note: ÿ`s exist to hide objects from the GHC compiler, which can normally perform many optimizations that change pointer equality. A Ticket, on the other hand, is a first-class object that can be handled by the user, but will not have its pointer identity changed by compiler optimizations (but will of course, change addresses during garbage collection).NUnsafe, machine-level atomic compare and swap on an element within an Array. ()*()*None; eYou should not depend on this type. It varies between different implementations of atomic counters.$The type of mutable atomic counters. 4Create a new counter initialized to the given value.+$Create a new, uninitialized counter. Equivalent to   followed by   . ;Make a non-atomic write to the counter. No memory-barrier. Just like the  Data.Atomics­ CAS interface, this routine returns an opaque ticket that can be used in CAS operations. Except for the difference in return type, the semantics of this are the same as  . MOpaque tickets cannot be constructed, but they can be destructed into values.<Compare and swap for the counter ADT. Similar behavior to æ, in particular, in both success and failure cases it returns a ticket that you should use for the next attempt. (That is, in the success case, it actually returns the new value that you provided as input, but in ticket form.)®Increment the counter by a given amount. Returns the value AFTER the increment (in contrast with the behavior of the underlying instruction on architectures like x86.)oNote that UNLIKE with boxed implementations of counters, where increment is based on CAS, this increment is O(1);. Fetch-and-add does not require a retry loop like CAS.AAn alternate version for when you don't care about the old value. ,- +       ,- + None;M6Memory barrier implemented by the GHC rts (see SMP.h).6Memory barrier implemented by the GHC rts (see SMP.h).6Memory barrier implemented by the GHC rts (see SMP.h).-Compare-and-swap. Follows the same rules as  2, returning the ticket for then next operation.>By convention this is WHNF strict in the "new" value provided.$This variant takes two tickets: the newD value is a ticket rather than an arbitrary, lifted, Haskell value.SOrdinary processor load instruction (non-atomic, not implying any memory barriers).~Compare and swap on word-sized chunks of a byte-array. For indexing purposes the bytearray is treated as an array of words (.s). Note that UNLIKE   and casArrayTicketed+, this does not need to operate on tickets.)Further, this version always returns the  old value¶, that was read from the array during the CAS operation. That is, it follows the normal protocol for CAS operations (and matches the underlying instruction on most architectures).Implies a full memory barrier.,Atomically add to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.1Atomically subtract to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.4Atomically bitwise AND to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.5Atomically bitwise NAND to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.3Atomically bitwise OR to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.4Atomically bitwise XOR to a word of memory within a /M, returning the value *before* the operation. Implies a full memory barrier.,Atomically add to a word of memory within a /.³This function returns the NEW value of the location after the increment. Thus, it is a bit misnamed, and in other contexts might be called "add-and-fetch", such as in GCC's __sync_add_and_fetch.SOrdinary processor load instruction (non-atomic, not implying any memory barriers).)The difference between this function and 0, is that it returns a ticket3, for use in future compare-and-swap operations. APerforms a machine-level compare and swap (CAS) operation on an 1. Returns a tuple containing a 2 which is 30 when a swap is performed, along with the most current value from the 1U. Note that this differs from the more common CAS behavior, which is to return the old value before the CAS occured.¾The reason for the difference is the ticket API. This function always returns the ticket that you should use in your next CAS attempt. In case of success, this ticket corresponds to the new+ value which you yourself installed in the 1^, whereas in the case of failure it represents the preexisting value currently in the IORef. <Note "compare" here means pointer equality in the sense of 4Û. However, the ticket API absolves the user of this module from needing to worry about the pointer equality of their values, which in general requires reasoning about the details of the Haskell implementation (GHC).®By convention this function is strict in the "new" value argument. This isn't absolutely necesary, but we think it's a bad habit to use unevaluated thunks in this context.!)This variant takes two tickets, i.e. the newD value is a ticket rather than an arbitrary, lifted, Haskell value."WA ticket contains or can get the usable Haskell value. This function does just that.#Like  , but for 5.$MutVar counterpart of  .>By convention this is WHNF strict in the "new" value provided.%)This variant takes two tickets, i.e. the newD value is a ticket rather than an arbitrary, lifted, Haskell value.&A drop-in replacement for &ÿ that optimistically attempts to compute the new value and CAS it into place without introducing new thunks or locking anything. Note that this is more STRICT than its standard counterpart and will only place evaluated (WHNF) values in the IORef.©The upside is that sometimes we see a performance benefit. The downside is that this version is speculative -- when it retries, it must reexecute the compution.'GA simpler version that modifies the state but does not return anything.6The offset into the arrayThe value to be addedThe value *before* the additionThe offset into the arrayThe value to be subtractedThe value *before* the additionThe offset into the arrayThe value to be AND-edThe value *before* the additionThe offset into the arrayThe value to be NAND-edThe value *before* the additionThe offset into the arrayThe value to be OR-edThe value *before* the additionThe offset into the arrayThe value to be XOR-edThe value *before* the addition7 The 1 containing a value currentA ticket for the old valueThe new value to replace current if old == current1Success flag, plus ticket for the NEXT operation.!A ticket for the old valueA ticket for the new value"8#$%&Mutable location to modify0Computation runs one or more times (speculation)' !"#$%&'" !&'#$%67 !"8#$%&'9      !"#$%&'()*+,- ./012345678978:2;2<=>1?@Aatomic-primops-0.8Data.Atomics.InternalData.Atomics.Counter Data.AtomicscasIORefghc-primGHC.Prim casIntArray#fetchAddIntArray#TicketcasArrayTicketed#ptrEq readForCAS#casMutVarTicketed#CTicket AtomicCounter newCounter readCounter writeCounterreadCounterForCAS peekCTicket casCounter incrCounter incrCounter_ writeBarrierloadLoadBarrierstoreLoadBarrier casArrayElem casArrayElem2 readArrayElemcasByteArrayIntfetchAddIntArrayfetchSubIntArrayfetchAndIntArrayfetchNandIntArrayfetchOrIntArrayfetchXorIntArrayfetchAddByteArrayInt readForCAS casIORef2 peekTicketreadMutVarForCAS casMutVar casMutVar2atomicModifyIORefCASatomicModifyIORefCAS_ $fEqTicket $fShowTicket newRawCounter==# GHC.TypesInt primitive-0.6Data.Primitive.ByteArrayMutableByteArraybase GHC.IORef readIORefIORefBoolTruereallyUnsafePtrEquality#MutVar# doAtomicRMWseal