-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Primeval world of Haskell. -- -- Please see the README on GitHub at -- https://github.com/lehins/primal#readme @package primal @version 0.2.0.0 module Control.Prim.Monad.Throw -- | A class for monads in which exceptions may be thrown. -- -- Instances should obey the following law: -- --
--   throwM e >> x = throwM e
--   
-- -- In other words, throwing an exception short-circuits the rest of the -- monadic computation. -- --

Note

-- -- This is an identical class to MonadThrow from -- exceptions package. The reason why it was copied, instead of -- a direct depency on the aforementioned package is because -- MonadCatch and MonadMask are not right abstractions -- for exception handling in presence of concurrency. class Monad m => MonadThrow m -- | Throw an exception. Note that this throws when this action is run in -- the monad m, not when it is applied. It is a generalization -- of Control.Exception's throwIO. -- -- Should satisfy the law: -- --
--   throwM e >> f = throwM e
--   
throwM :: (MonadThrow m, Exception e) => e -> m a instance Control.Prim.Monad.Throw.MonadThrow GHC.Maybe.Maybe instance (e Data.Type.Equality.~ GHC.Exception.Type.SomeException) => Control.Prim.Monad.Throw.MonadThrow (Data.Either.Either e) instance Control.Prim.Monad.Throw.MonadThrow GHC.Types.IO instance Control.Prim.Monad.Throw.MonadThrow (GHC.ST.ST s) instance Control.Prim.Monad.Throw.MonadThrow GHC.Conc.Sync.STM instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Cont.ContT r m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Except.ExceptT e m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Identity.IdentityT m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Maybe.MaybeT m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Reader.ReaderT r m) instance (GHC.Base.Monoid w, Control.Prim.Monad.Throw.MonadThrow m) => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance (GHC.Base.Monoid w, Control.Prim.Monad.Throw.MonadThrow m) => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.RWS.Strict.RWST r w s m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.State.Lazy.StateT s m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.State.Strict.StateT s m) instance (GHC.Base.Monoid w, Control.Prim.Monad.Throw.MonadThrow m) => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (GHC.Base.Monoid w, Control.Prim.Monad.Throw.MonadThrow m) => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Writer.Strict.WriterT w m) instance (GHC.Base.Monoid w, Control.Prim.Monad.Throw.MonadThrow m) => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Accum.AccumT w m) instance Control.Prim.Monad.Throw.MonadThrow m => Control.Prim.Monad.Throw.MonadThrow (Control.Monad.Trans.Select.SelectT r m) module Control.Prim.Monad.Unsafe -- | Unwrap any MonadPrimBase action while coercing the state token -- --

Highly unsafe!

unsafePrimBase :: MonadPrimBase s' m => m a -> State# s -> (# State# s, a #) -- | Unwrap any MonadPrimBase action that does not return anything, -- while coercing the state token -- --

Highly unsafe!

unsafePrimBase_ :: MonadPrimBase s' m => m () -> State# s -> State# s -- | Convert a MonadPrimBase action to another MonadPrim -- while coercing the state token. -- --

Highly unsafe!

unsafePrimBaseToPrim :: (MonadPrimBase sn n, MonadPrim sm m) => n a -> m a -- | Convert a MonadPrimBase action to IO while coercing the -- state token to RealWorld. -- --

Highly unsafe!

unsafePrimBaseToIO :: MonadPrimBase s m => m a -> IO a -- | Convert a MonadPrimBase action to ST while coercing the -- state token s. -- --

Highly unsafe!

unsafePrimBaseToST :: MonadPrimBase sm m => m a -> ST s a -- | Convert an IO action to some MonadPrim while coercing -- the state token. -- --

Highly unsafe!

-- -- It is similar to unsafeSTToIO, except resulting action can be -- any other MonadPrim action, therefore it is a lot more -- dangerous. unsafeIOToPrim :: MonadPrim s m => IO a -> m a -- | Convert an ST action to some MonadPrim while coercing -- the state token. -- --

Highly unsafe!

unsafeSTToPrim :: MonadPrim s' m => ST s a -> m a -- | A version of liftPrimBase that coerce the state token. -- --

Highly unsafe!

unsafeLiftPrimBase :: forall sn n sm m a. (MonadPrimBase sn n, MonadPrim sm m) => n a -> m a -- | Same as noDuplicate, except works in any MonadPrim. noDuplicatePrim :: MonadPrim s m => m () -- | Same as unsafeDupablePerformIO, except works not only with -- IO, but with other MonadPrimBase actions as well. -- Reading and writing values into memory is safe, as long as writing -- action is idempotent. On the other hand things like memory or resource -- allocation, exceptions handling are not safe at all, since supplied -- action can be run multiple times and a copy interrupted at will. unsafeDupablePerformPrimBase :: MonadPrimBase s m => m a -> a -- | Take an IO and compute it as a pure value, while inlining the -- action itself. -- --

Ridiculously unsafe!

-- -- This is even more unsafe then both unsafePerformIO and -- unsafeDupableInterleaveIO. -- -- The only time it is really safe to use is on idempotent action that -- only read values from memory, but do note do any mutation, allocation -- and certainly not interaction with real world. -- -- In `bytestring` it is known as -- accursedUnutterablePerformIO. Here are some resources that -- discuss it's unsafety: -- -- unsafeInlineIO :: IO a -> a -- | Take an ST and compute it as a pure value, while inlining the -- action itself. Same as unsafeInlineIO. -- --

Ridiculously unsafe!

unsafeInlineST :: ST s a -> a -- | Take any MonadPrimBase action and compute it as a pure value, -- while inlining the action. Same as unsafeInlineIO, but applied -- to any MonadPrimBase action. -- --

Ridiculously unsafe!

unsafeInlinePrimBase :: MonadPrimBase s m => m a -> a -- | Same as unsafeInterleaveIO, except works in any -- MonadPrimBase unsafeInterleavePrimBase :: MonadPrimBase s m => m a -> m a -- | Same as unsafeDupableInterleaveIO, except works in any -- MonadPrimBase unsafeDupableInterleavePrimBase :: MonadPrimBase s m => m a -> m a -- | This is the "back door" into the IO monad, allowing IO -- computation to be performed at any time. For this to be safe, the -- IO computation should be free of side effects and independent -- of its environment. -- -- If the I/O computation wrapped in unsafePerformIO performs side -- effects, then the relative order in which those side effects take -- place (relative to the main I/O trunk, or other calls to -- unsafePerformIO) is indeterminate. Furthermore, when using -- unsafePerformIO to cause side-effects, you should take the -- following precautions to ensure the side effects are performed as many -- times as you expect them to be. Note that these precautions are -- necessary for GHC, but may not be sufficient, and other compilers may -- require different precautions: -- -- -- -- It is less well known that unsafePerformIO is not type safe. -- For example: -- --
--   test :: IORef [a]
--   test = unsafePerformIO $ newIORef []
--   
--   main = do
--           writeIORef test [42]
--           bang <- readIORef test
--           print (bang :: [Char])
--   
-- -- This program will core dump. This problem with polymorphic references -- is well known in the ML community, and does not arise with normal -- monadic use of references. There is no easy way to make it impossible -- once you use unsafePerformIO. Indeed, it is possible to write -- coerce :: a -> b with the help of unsafePerformIO. -- So be careful! unsafePerformIO :: () => IO a -> a -- | This version of unsafePerformIO is more efficient because it -- omits the check that the IO is only being performed by a single -- thread. Hence, when you use unsafeDupablePerformIO, there is a -- possibility that the IO action may be performed multiple times (on a -- multiprocessor), and you should therefore ensure that it gives the -- same results each time. It may even happen that one of the duplicated -- IO actions is only run partially, and then interrupted in the middle -- without an exception being raised. Therefore, functions like -- bracket cannot be used safely within -- unsafeDupablePerformIO. unsafeDupablePerformIO :: () => IO a -> a -- | unsafeInterleaveIO allows an IO computation to be -- deferred lazily. When passed a value of type IO a, the -- IO will only be performed when the value of the a is -- demanded. This is used to implement lazy file reading, see -- hGetContents. unsafeInterleaveIO :: () => IO a -> IO a -- | unsafeDupableInterleaveIO allows an IO computation to be -- deferred lazily. When passed a value of type IO a, the -- IO will only be performed when the value of the a is -- demanded. -- -- The computation may be performed multiple times by different threads, -- possibly at the same time. To ensure that the computation is performed -- only once, use unsafeInterleaveIO instead. unsafeDupableInterleaveIO :: () => IO a -> IO a module Control.Prim.Exception isSyncException :: Exception e => e -> Bool isAsyncException :: Exception e => e -> Bool -- | This is the same as throwM, but restricted to MonadPrim throwPrim :: (Exception e, MonadPrim s m) => e -> m a catch :: forall e a m. (Exception e, MonadUnliftPrim RW m) => m a -> (e -> m a) -> m a catchAny :: forall a m. MonadUnliftPrim RW m => m a -> (SomeException -> m a) -> m a catchAnySync :: forall a m. MonadUnliftPrim RW m => m a -> (SomeException -> m a) -> m a catchAll :: forall a m. MonadUnliftPrim RW m => m a -> (forall e. Exception e => e -> m a) -> m a catchAllSync :: forall a m. MonadUnliftPrim RW m => m a -> (forall e. Exception e => e -> m a) -> m a maskAsyncExceptions :: forall a m. MonadUnliftPrim RW m => m a -> m a unmaskAsyncExceptions :: forall a m. MonadUnliftPrim RW m => m a -> m a maskUninterruptible :: forall a m. MonadUnliftPrim RW m => m a -> m a -- | Same as getMaskingState, but generalized to MonadPrim getMaskingState :: MonadPrim RW m => m MaskingState -- | Similar to throwTo from unliftio this will wrap any -- known non-async exception with SomeAsyncException, because -- otherwise semantics of throwTo with respect to asynchronous -- exceptions are violated. throwTo :: (MonadPrim RW m, Exception e) => ThreadId -> e -> m () module Control.Prim.Concurrent getThreadId :: ThreadId# -> CInt spark :: MonadPrim s m => a -> m a numSparks :: MonadPrim s m => m Int runSparks :: MonadPrim s m => m () -- | Wrapper for delay#. Sleep specified number of microseconds. Not -- designed for threaded runtime: Errors when compiled with -- -threaded delay :: MonadPrim s m => Int -> m () -- | Wrapper for waitRead#. Block and wait for input to become -- available on the Fd. Not designed for threaded runtime: -- Errors when compiled with -threaded waitRead :: MonadPrim s m => Fd -> m () -- | Wrapper for waitWrite#. Block and wait until output is possible -- on the Fd. Not designed for threaded runtime: Errors when -- compiled with -threaded waitWrite :: MonadPrim s m => Fd -> m () -- | Wrapper around fork#. Unlike forkIO it does not install -- any exception handlers on the action, so you need make sure to do it -- yourself. fork :: MonadPrim RW m => m () -> m ThreadId -- | Wrapper around forkOn#. Unlike forkOn it does not -- install any exception handlers on the action, so you need make sure to -- do it yourself. forkOn :: MonadPrim RW m => Int -> m () -> m ThreadId -- | Wrapper around killThread#, which throws ThreadKilled -- exception in the target thread. Use throwTo if you want a -- different exception to be thrown. killThread :: MonadPrim RW m => ThreadId -> m () -- | Wrapper around yield#. yield :: MonadPrim RW m => m () -- | Wrapper around myThreadId#. myThreadId :: MonadPrim RW m => m ThreadId -- | Pointer should refer to UTF8 encoded string of bytes labelThread :: MonadPrim RW m => ThreadId -> Ptr a -> m () isCurrentThreadBoundPrim :: MonadPrim RW m => m Bool threadStatus :: MonadPrim RW m => ThreadId -> m ThreadStatus threadCapability :: MonadPrim RW m => ThreadId -> m (Int, Bool) -- | Something that is not available in base. Convert a -- ThreadId to a regular integral type. threadIdToCInt :: ThreadId -> CInt id2TSO :: ThreadId -> ThreadId# module Control.Prim.Eval -- | This is an action that ensures that the value is still available and -- garbage collector has not cleaned it up. -- -- Make sure not to use it after some computation that doesn't return, -- like after forever for example, otherwise touch will simply -- be removed by ghc and bad things will happen. If you have a case like -- that, make sure to use withAlivePrimBase or -- withAliveUnliftPrim instead. touch :: MonadPrim s m => a -> m () -- | An action that evaluates a value to weak head normal form. Same as -- evaluate, except it works in a MonadPrim seqPrim :: MonadPrim s m => a -> m a -- | Forward compatible operator that might be introduced in some future -- ghc version. -- -- See: !3131 -- -- Current version is not as efficient as the version that will be -- introduced in the future, because it works around the ghc bug by -- simply preventing inlining and relying on the touch function. keepAlive# :: a -> (State# s -> (# State# s, r #)) -> State# s -> (# State# s, r #) -- | Similar to touch. See withAlive# for more info. withAlivePrimBase :: (MonadPrimBase s n, MonadPrim s m) => a -> n b -> m b -- | Similar to touch. See withAlive# for more info. withAliveUnliftPrim :: MonadUnliftPrim s m => a -> m b -> m b module Control.Prim.Monad -- | A shorter synonym for the magical RealWorld type RW = RealWorld -- | RealWorld is deeply magical. It is primitive, but it -- is not unlifted (hence ptrArg). We never manipulate -- values of type RealWorld; it's only used in the type system, -- to parameterise State#. data RealWorld :: Type class MonadThrow m => MonadPrim s m | m -> s -- | Construct a primitive action prim :: MonadPrim s m => (State# s -> (# State# s, a #)) -> m a class MonadUnliftPrim s m => MonadPrimBase s m -- | Unwrap a primitive action primBase :: MonadPrimBase s m => m a -> State# s -> (# State# s, a #) class MonadPrim s m => MonadUnliftPrim s m withRunInPrimBase :: (MonadUnliftPrim s m, MonadPrimBase s n) => ((forall a. m a -> n a) -> n b) -> m b -- | Construct a primitive action that does not return anything. prim_ :: MonadPrim s m => (State# s -> State# s) -> m () primBase_ :: MonadPrimBase s m => m () -> State# s -> State# s runInPrimBase :: forall s m a b. MonadUnliftPrim s m => m a -> ((State# s -> (# State# s, a #)) -> State# s -> (# State# s, b #)) -> m b -- | Lift an IO action to MonadPrim with the RealWorld -- state token. Type restricted synonym for liftPrimBase liftPrimIO :: MonadPrim RW m => IO a -> m a -- | Lift an ST action to MonadPrim with the same state -- token. Type restricted synonym for liftPrimBase liftPrimST :: MonadPrim s m => ST s a -> m a -- | Lift an action from the MonadPrimBase to another -- MonadPrim with the same state token. liftPrimBase :: (MonadPrimBase s n, MonadPrim s m) => n a -> m a -- | Restrict a MonadPrimBase action that works with -- RealWorld to IO. primBaseToIO :: MonadPrimBase RealWorld m => m a -> IO a -- | Restrict a MonadPrimBase action that works in ST. primBaseToST :: MonadPrimBase s m => m a -> ST s a -- | This is an action that ensures that the value is still available and -- garbage collector has not cleaned it up. -- -- Make sure not to use it after some computation that doesn't return, -- like after forever for example, otherwise touch will simply -- be removed by ghc and bad things will happen. If you have a case like -- that, make sure to use withAlivePrimBase or -- withAliveUnliftPrim instead. touch :: MonadPrim s m => a -> m () -- | An action that evaluates a value to weak head normal form. Same as -- evaluate, except it works in a MonadPrim seqPrim :: MonadPrim s m => a -> m a -- | Similar to touch. See withAlive# for more info. withAlivePrimBase :: (MonadPrimBase s n, MonadPrim s m) => a -> n b -> m b -- | Similar to touch. See withAlive# for more info. withAliveUnliftPrim :: MonadUnliftPrim s m => a -> m b -> m b -- | Helper function that converts a type into a string showsType :: Typeable t => proxy t -> ShowS module Data.Prim.StableName -- | An abstract name for an object, that supports equality and hashing. -- -- Stable names have the following property: -- -- -- -- The reverse is not necessarily true: if two stable names are not -- equal, then the objects they name may still be equal. Note in -- particular that makeStableName may return a different -- StableName after an object is evaluated. -- -- Stable Names are similar to Stable Pointers -- (Foreign.StablePtr), but differ in the following ways: -- -- data StableName a StableName :: StableName# a -> StableName a -- | Makes a StableName for an arbitrary object. The object passed -- as the first argument is not evaluated by makeStableName. makeStableName :: MonadPrim RW m => a -> m (StableName a) -- | Similar to `makeDynamicStableName`, but returns -- StableName Any and is generalized to MonadPrim makeAnyStableName :: MonadPrim RW m => a -> m (StableName Any) -- | Convert a StableName to an Int. The Int returned -- is not necessarily unique; several StableNames may map to the -- same Int (in practice however, the chances of this are small, -- so the result of hashStableName makes a good hash key). hashStableName :: () => StableName a -> Int -- | Equality on StableName that does not require that the types of -- the arguments match. eqStableName :: () => StableName a -> StableName b -> Bool instance GHC.Show.Show (GHC.StableName.StableName a) module Foreign.Prim unsafeThawByteArray# :: ByteArray# -> State# s -> (# State# s, MutableByteArray# s #) mutableByteArrayContents# :: MutableByteArray# s -> Addr# unsafeThawArrayArray# :: ArrayArray# -> State# s -> (# State# s, MutableArrayArray# s #) unInt# :: Int -> Int# unWord# :: Word -> Word# -- | Read 8-bit character; offset in bytes. indexWord8ArrayAsChar# :: ByteArray# -> Int# -> Char# readWord8ArrayAsChar# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Char# #) writeWord8ArrayAsChar# :: () => MutableByteArray# d -> Int# -> Char# -> State# d -> State# d -- | Read 31-bit character; offset in bytes. indexWord8ArrayAsWideChar# :: ByteArray# -> Int# -> Char# readWord8ArrayAsWideChar# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Char# #) writeWord8ArrayAsWideChar# :: () => MutableByteArray# d -> Int# -> Char# -> State# d -> State# d -- | Read address; offset in bytes. indexWord8ArrayAsAddr# :: ByteArray# -> Int# -> Addr# readWord8ArrayAsAddr# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Addr# #) writeWord8ArrayAsAddr# :: () => MutableByteArray# d -> Int# -> Addr# -> State# d -> State# d -- | Read stable pointer; offset in bytes. indexWord8ArrayAsStablePtr# :: () => ByteArray# -> Int# -> StablePtr# a readWord8ArrayAsStablePtr# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, StablePtr# a #) writeWord8ArrayAsStablePtr# :: () => MutableByteArray# d -> Int# -> StablePtr# a -> State# d -> State# d -- | Read float; offset in bytes. indexWord8ArrayAsFloat# :: ByteArray# -> Int# -> Float# readWord8ArrayAsFloat# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Float# #) writeWord8ArrayAsFloat# :: () => MutableByteArray# d -> Int# -> Float# -> State# d -> State# d -- | Read double; offset in bytes. indexWord8ArrayAsDouble# :: ByteArray# -> Int# -> Double# readWord8ArrayAsDouble# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Double# #) writeWord8ArrayAsDouble# :: () => MutableByteArray# d -> Int# -> Double# -> State# d -> State# d -- | Read 16-bit int; offset in bytes. indexWord8ArrayAsInt16# :: ByteArray# -> Int# -> Int# readWord8ArrayAsInt16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #) writeWord8ArrayAsInt16# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d -- | Read 32-bit int; offset in bytes. indexWord8ArrayAsInt32# :: ByteArray# -> Int# -> Int# readWord8ArrayAsInt32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #) writeWord8ArrayAsInt32# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d -- | Read 64-bit int; offset in bytes. indexWord8ArrayAsInt64# :: ByteArray# -> Int# -> Int# readWord8ArrayAsInt64# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #) writeWord8ArrayAsInt64# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d -- | Read int; offset in bytes. indexWord8ArrayAsInt# :: ByteArray# -> Int# -> Int# readWord8ArrayAsInt# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #) writeWord8ArrayAsInt# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d -- | Read 16-bit word; offset in bytes. indexWord8ArrayAsWord16# :: ByteArray# -> Int# -> Word# readWord8ArrayAsWord16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #) writeWord8ArrayAsWord16# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d -- | Read 32-bit word; offset in bytes. indexWord8ArrayAsWord32# :: ByteArray# -> Int# -> Word# readWord8ArrayAsWord32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #) writeWord8ArrayAsWord32# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d -- | Read 64-bit word; offset in bytes. indexWord8ArrayAsWord64# :: ByteArray# -> Int# -> Word# readWord8ArrayAsWord64# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #) writeWord8ArrayAsWord64# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d -- | Read word; offset in bytes. indexWord8ArrayAsWord# :: ByteArray# -> Int# -> Word# readWord8ArrayAsWord# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #) writeWord8ArrayAsWord# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d -- | Slightly slower reimplementation of newer primops using the old -- atomicModifyMutVar# -- -- Modify the contents of a MutVar#, returning the previous -- contents and the result of applying the given function to the previous -- contents. -- -- Warning: this can fail with an unchecked exception. atomicModifyMutVar_# :: MutVar# s a -> (a -> a) -> State# s -> (# State# s, a, a #) -- | Slightly slower reimplementation of newer primops using the old -- atomicModifyMutVar# -- -- Modify the contents of a MutVar#, returning the previous -- contents and the result of applying the given function to the previous -- contents. -- -- Warning: this can fail with an unchecked exception. atomicModifyMutVar2# :: MutVar# s a -> (a -> (a, b)) -> State# s -> (# State# s, a, (a, b) #) -- | compareByteArrays# src1 src1_ofs src2 src2_ofs n compares -- n bytes starting at offset src1_ofs in the first -- ByteArray# src1 to the range of n bytes -- (i.e. same length) starting at offset src2_ofs of the second -- ByteArray# src2. Both arrays must fully contain the -- specified ranges, but this is not checked. Returns an Int# -- less than, equal to, or greater than zero if the range is found, -- respectively, to be byte-wise lexicographically less than, to match, -- or be greater than the second range. compareByteArrays# :: ByteArray# -> Int# -> ByteArray# -> Int# -> Int# -> Int# -- | Haskell type representing the C bool type. newtype CBool CBool :: Word8 -> CBool -- | Determine whether a ByteArray# is guaranteed not to move -- during GC. isByteArrayPinned# :: ByteArray# -> Int# -- | Determine whether a MutableByteArray# is guaranteed not to -- move during GC. isMutableByteArrayPinned# :: () => MutableByteArray# d -> Int# -- | Return the number of elements in the array. getSizeofMutableByteArray# :: () => MutableByteArray# d -> State# d -> (# State# d, Int# #) syncXorFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncXorFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncXorFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncXorFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncXorFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncXorFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncXorFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncXorFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncOrFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncOrFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncOrFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncOrFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncOrFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncOrFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncOrFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncOrFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncNandFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncNandFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncNandFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncNandFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncNandFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncNandFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncNandFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncNandFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncAndFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncAndFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncAndFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncAndFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncAndFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncAndFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncAndFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncAndFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncSubFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncSubFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncSubFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncSubFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncSubFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncSubFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncSubFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncSubFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncAddFetchNewWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncAddFetchNewWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncAddFetchNewInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncAddFetchNewInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncAddFetchOldWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> IO Word64 syncAddFetchOldWord64AddrIO :: Addr# -> Int# -> Word64 -> IO Word64 syncAddFetchOldInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> IO Int64 syncAddFetchOldInt64AddrIO :: Addr# -> Int# -> Int64 -> IO Int64 syncCasWord64ArrayIO :: MutableByteArray# s -> Int# -> Word64 -> Word64 -> IO Word64 syncCasWord64AddrIO :: Addr# -> Int# -> Word64 -> Word64 -> IO Word64 syncCasInt64ArrayIO :: MutableByteArray# s -> Int# -> Int64 -> Int64 -> IO Int64 syncCasInt64AddrIO :: Addr# -> Int# -> Int64 -> Int64 -> IO Int64 syncCasWord64BoolArrayIO :: MutableByteArray# s -> Int# -> Word64 -> Word64 -> IO CBool syncCasWord64BoolAddrIO :: Addr# -> Int# -> Word64 -> Word64 -> IO CBool syncCasInt64BoolArrayIO :: MutableByteArray# s -> Int# -> Int64 -> Int64 -> IO CBool syncCasInt64BoolAddrIO :: Addr# -> Int# -> Int64 -> Int64 -> IO CBool syncXorFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncXorFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncXorFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncXorFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncXorFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncXorFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncXorFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncXorFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncOrFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncOrFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncOrFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncOrFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncOrFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncOrFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncOrFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncOrFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncNandFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncNandFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncNandFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncNandFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncNandFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncNandFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncNandFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncNandFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncAndFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncAndFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncAndFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncAndFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncAndFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncAndFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncAndFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncAndFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncSubFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncSubFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncSubFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncSubFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncSubFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncSubFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncSubFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncSubFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncAddFetchNewWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncAddFetchNewWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncAddFetchNewIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncAddFetchNewIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncAddFetchOldWordArrayIO :: MutableByteArray# s -> Int# -> Word -> IO Word syncAddFetchOldWordAddrIO :: Addr# -> Int# -> Word -> IO Word syncAddFetchOldIntArrayIO :: MutableByteArray# s -> Int# -> Int -> IO Int syncAddFetchOldIntAddrIO :: Addr# -> Int# -> Int -> IO Int syncCasWordArrayIO :: MutableByteArray# s -> Int# -> Word -> Word -> IO Word syncCasWordAddrIO :: Addr# -> Int# -> Word -> Word -> IO Word syncCasIntArrayIO :: MutableByteArray# s -> Int# -> Int -> Int -> IO Int syncCasIntAddrIO :: Addr# -> Int# -> Int -> Int -> IO Int syncCasWordBoolArrayIO :: MutableByteArray# s -> Int# -> Word -> Word -> IO CBool syncCasWordBoolAddrIO :: Addr# -> Int# -> Word -> Word -> IO CBool syncCasIntBoolArrayIO :: MutableByteArray# s -> Int# -> Int -> Int -> IO CBool syncCasIntBoolAddrIO :: Addr# -> Int# -> Int -> Int -> IO CBool syncXorFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncXorFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncXorFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncXorFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncXorFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncXorFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncXorFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncXorFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncOrFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncOrFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncOrFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncOrFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncOrFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncOrFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncOrFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncOrFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncNandFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncNandFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncNandFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncNandFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncNandFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncNandFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncNandFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncNandFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncAndFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncAndFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncAndFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncAndFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncAndFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncAndFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncAndFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncAndFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncSubFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncSubFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncSubFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncSubFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncSubFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncSubFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncSubFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncSubFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncAddFetchNewWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncAddFetchNewWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncAddFetchNewInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncAddFetchNewInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncAddFetchOldWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> IO Word32 syncAddFetchOldWord32AddrIO :: Addr# -> Int# -> Word32 -> IO Word32 syncAddFetchOldInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> IO Int32 syncAddFetchOldInt32AddrIO :: Addr# -> Int# -> Int32 -> IO Int32 syncCasWord32ArrayIO :: MutableByteArray# s -> Int# -> Word32 -> Word32 -> IO Word32 syncCasWord32AddrIO :: Addr# -> Int# -> Word32 -> Word32 -> IO Word32 syncCasInt32ArrayIO :: MutableByteArray# s -> Int# -> Int32 -> Int32 -> IO Int32 syncCasInt32AddrIO :: Addr# -> Int# -> Int32 -> Int32 -> IO Int32 syncCasWord32BoolArrayIO :: MutableByteArray# s -> Int# -> Word32 -> Word32 -> IO CBool syncCasWord32BoolAddrIO :: Addr# -> Int# -> Word32 -> Word32 -> IO CBool syncCasInt32BoolArrayIO :: MutableByteArray# s -> Int# -> Int32 -> Int32 -> IO CBool syncCasInt32BoolAddrIO :: Addr# -> Int# -> Int32 -> Int32 -> IO CBool syncXorFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncXorFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncXorFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncXorFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncXorFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncXorFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncXorFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncXorFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncOrFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncOrFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncOrFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncOrFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncOrFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncOrFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncOrFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncOrFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncNandFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncNandFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncNandFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncNandFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncNandFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncNandFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncNandFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncNandFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncAndFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncAndFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncAndFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncAndFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncAndFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncAndFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncAndFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncAndFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncSubFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncSubFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncSubFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncSubFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncSubFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncSubFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncSubFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncSubFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncAddFetchNewWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncAddFetchNewWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncAddFetchNewInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncAddFetchNewInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncAddFetchOldWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> IO Word16 syncAddFetchOldWord16AddrIO :: Addr# -> Int# -> Word16 -> IO Word16 syncAddFetchOldInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> IO Int16 syncAddFetchOldInt16AddrIO :: Addr# -> Int# -> Int16 -> IO Int16 syncCasWord16ArrayIO :: MutableByteArray# s -> Int# -> Word16 -> Word16 -> IO Word16 syncCasWord16AddrIO :: Addr# -> Int# -> Word16 -> Word16 -> IO Word16 syncCasInt16ArrayIO :: MutableByteArray# s -> Int# -> Int16 -> Int16 -> IO Int16 syncCasInt16AddrIO :: Addr# -> Int# -> Int16 -> Int16 -> IO Int16 syncCasWord16BoolArrayIO :: MutableByteArray# s -> Int# -> Word16 -> Word16 -> IO CBool syncCasWord16BoolAddrIO :: Addr# -> Int# -> Word16 -> Word16 -> IO CBool syncCasInt16BoolArrayIO :: MutableByteArray# s -> Int# -> Int16 -> Int16 -> IO CBool syncCasInt16BoolAddrIO :: Addr# -> Int# -> Int16 -> Int16 -> IO CBool syncXorFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncXorFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncXorFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncXorFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncXorFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncXorFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncXorFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncXorFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncOrFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncOrFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncOrFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncOrFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncOrFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncOrFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncOrFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncOrFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncNandFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncNandFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncNandFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncNandFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncNandFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncNandFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncNandFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncNandFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncAndFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncAndFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncAndFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncAndFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncAndFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncAndFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncAndFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncAndFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncSubFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncSubFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncSubFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncSubFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncSubFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncSubFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncSubFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncSubFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncAddFetchNewWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncAddFetchNewWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncAddFetchNewInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncAddFetchNewInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncAddFetchOldWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> IO Word8 syncAddFetchOldWord8AddrIO :: Addr# -> Int# -> Word8 -> IO Word8 syncAddFetchOldInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> IO Int8 syncAddFetchOldInt8AddrIO :: Addr# -> Int# -> Int8 -> IO Int8 syncCasWord8ArrayIO :: MutableByteArray# s -> Int# -> Word8 -> Word8 -> IO Word8 syncCasWord8AddrIO :: Addr# -> Int# -> Word8 -> Word8 -> IO Word8 syncCasInt8ArrayIO :: MutableByteArray# s -> Int# -> Int8 -> Int8 -> IO Int8 syncCasInt8AddrIO :: Addr# -> Int# -> Int8 -> Int8 -> IO Int8 syncCasWord8BoolArrayIO :: MutableByteArray# s -> Int# -> Word8 -> Word8 -> IO CBool syncCasWord8BoolAddrIO :: Addr# -> Int# -> Word8 -> Word8 -> IO CBool syncCasInt8BoolArrayIO :: MutableByteArray# s -> Int# -> Int8 -> Int8 -> IO CBool syncCasInt8BoolAddrIO :: Addr# -> Int# -> Int8 -> Int8 -> IO CBool syncLockReleaseInt8AddrIO :: Addr# -> Int# -> IO () syncLockReleaseInt8ArrayIO :: MutableByteArray# s -> Int# -> IO () syncLockTestSetInt8AddrIO :: Addr# -> Int# -> IO Int8 syncLockTestSetInt8ArrayIO :: MutableByteArray# s -> Int# -> IO Int8 syncSynchronize :: IO () -- | Helper function for converting casBool IO actions ioCBoolToBoolBase :: IO CBool -> State# s -> (# State# s, Bool #) -- | Memory barrier. This will ensure that the cache is fully -- updated before continuing. syncSynchronize# :: State# s -> State# s withMemBarrier# :: (State# s -> (# State# s, a #)) -> State# s -> (# State# s, a #) withMemBarrier_# :: (State# s -> State# s) -> State# s -> State# s -- | Because GC is guaranteed not to move unpinned memory during the unsafe -- FFI call we can compare memory pointers on the C side. Because the -- addresses cannot change underneath us we can safely guarantee pointer -- equality for the same pinned or unpinned arrays isSameByteArray# :: ByteArray# -> ByteArray# -> Int# isSameMutableByteArray# :: MutableByteArray# s -> MutableByteArray# s -> Int# -- | Convert memcmp result into an ordering toOrdering# :: Int# -> Ordering fromOrdering# :: Ordering -> Int# memcmpAddr# :: Addr# -> Int# -> Addr# -> Int# -> Int# -> Int# memcmpAddrByteArray# :: Addr# -> Int# -> ByteArray# -> Int# -> Int# -> Int# memcmpByteArray# :: ByteArray# -> Int# -> ByteArray# -> Int# -> Int# -> Int# memcmpByteArrayAddr# :: ByteArray# -> Int# -> Addr# -> Int# -> Int# -> Int# memsetWord8MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word8 -> IO () memsetWord8Addr# :: Addr# -> Int# -> Int# -> Word8 -> IO () memsetInt8MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int8 -> IO () memsetInt8Addr# :: Addr# -> Int# -> Int# -> Int8 -> IO () memsetWord16MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word16 -> IO () memsetWord16Addr# :: Addr# -> Int# -> Int# -> Word16 -> IO () memsetInt16MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int16 -> IO () memsetInt16Addr# :: Addr# -> Int# -> Int# -> Int16 -> IO () memsetWord32MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word32 -> IO () memsetWord32Addr# :: Addr# -> Int# -> Int# -> Word32 -> IO () memsetInt32MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int32 -> IO () memsetInt32Addr# :: Addr# -> Int# -> Int# -> Int32 -> IO () memsetWord64MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Word64 -> IO () memsetWord64Addr# :: Addr# -> Int# -> Int# -> Word64 -> IO () memsetInt64MutableByteArray# :: MutableByteArray# s -> Int# -> Int# -> Int64 -> IO () memsetInt64Addr# :: Addr# -> Int# -> Int# -> Int64 -> IO () memmoveAddr# :: Addr# -> Int# -> Addr# -> Int# -> Int# -> IO () memmoveMutableByteArray# :: MutableByteArray# s -> Int# -> MutableByteArray# s -> Int# -> Int# -> IO () memmoveMutableByteArrayToAddr# :: MutableByteArray# s -> Int# -> Addr# -> Int# -> Int# -> IO () memmoveMutableByteArrayFromAddr# :: Addr# -> Int# -> MutableByteArray# s -> Int# -> Int# -> IO () -- | Cast a 32bit Word into a Float word32ToFloat# :: Word# -> Float# -- | Cast a Float into a 32bit Word floatToWord32# :: Float# -> Word# -- | Cast a 64bit Word into a Double word64ToDouble# :: Word# -> Double# -- | Cast a Double into a 64bit Word doubleToWord64# :: Double# -> Word# module Data.Prim.Class -- | Invariants: -- -- class Prim a where { type family PrimBase a :: *; type family SizeOf a :: Nat; type family Alignment a :: Nat; type SizeOf a = SizeOf (PrimBase a); type Alignment a = Alignment (PrimBase a); } toPrimBase :: Prim a => a -> PrimBase a toPrimBase :: (Prim a, Coercible a (PrimBase a)) => a -> PrimBase a fromPrimBase :: Prim a => PrimBase a -> a fromPrimBase :: (Prim a, Coercible a (PrimBase a)) => PrimBase a -> a -- | Returned value must match the SizeOf type level Nat sizeOf# :: Prim a => Proxy# a -> Int# -- | Returned value must match the SizeOf type level Nat sizeOf# :: (Prim a, Prim (PrimBase a)) => Proxy# a -> Int# -- | Returned value must match the Alignment type level Nat alignment# :: Prim a => Proxy# a -> Int# -- | Returned value must match the Alignment type level Nat alignment# :: (Prim a, Prim (PrimBase a)) => Proxy# a -> Int# indexByteOffByteArray# :: Prim a => ByteArray# -> Int# -> a indexByteOffByteArray# :: (Prim a, Prim (PrimBase a)) => ByteArray# -> Int# -> a indexByteArray# :: Prim a => ByteArray# -> Int# -> a indexByteArray# :: (Prim a, Prim (PrimBase a)) => ByteArray# -> Int# -> a indexOffAddr# :: Prim a => Addr# -> Int# -> a indexOffAddr# :: (Prim a, Prim (PrimBase a)) => Addr# -> Int# -> a readByteOffMutableByteArray# :: Prim a => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) readByteOffMutableByteArray# :: (Prim a, Prim (PrimBase a)) => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) readMutableByteArray# :: Prim a => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) readMutableByteArray# :: (Prim a, Prim (PrimBase a)) => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) readOffAddr# :: Prim a => Addr# -> Int# -> State# s -> (# State# s, a #) readOffAddr# :: (Prim a, Prim (PrimBase a)) => Addr# -> Int# -> State# s -> (# State# s, a #) writeByteOffMutableByteArray# :: Prim a => MutableByteArray# s -> Int# -> a -> State# s -> State# s writeByteOffMutableByteArray# :: (Prim a, Prim (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> State# s writeMutableByteArray# :: Prim a => MutableByteArray# s -> Int# -> a -> State# s -> State# s writeMutableByteArray# :: (Prim a, Prim (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> State# s writeOffAddr# :: Prim a => Addr# -> Int# -> a -> State# s -> State# s writeOffAddr# :: (Prim a, Prim (PrimBase a)) => Addr# -> Int# -> a -> State# s -> State# s -- | Set the region of MutableByteArray to the same value. Offset is in -- number of elements setMutableByteArray# :: Prim a => MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s -- | Set the region of MutableByteArray to the same value. Offset is in -- number of elements setMutableByteArray# :: (Prim a, Prim (PrimBase a)) => MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s -- | Set the region of memory to the same value. Offset is in number of -- elements setOffAddr# :: Prim a => Addr# -> Int# -> Int# -> a -> State# s -> State# s -- | Set the region of memory to the same value. Offset is in number of -- elements setOffAddr# :: (Prim a, Prim (PrimBase a)) => Addr# -> Int# -> Int# -> a -> State# s -> State# s -- | A loop that uses writeMutableByteArray# to set the values in -- the region. It is a suboptimal way to fill the memory with a single -- value that is why it is only provided here for convenience setMutableByteArrayLoop# :: Prim a => MutableByteArray# s -> Int# -> Int# -> a -> State# s -> State# s setOffAddrLoop# :: Prim a => Addr# -> Int# -> Int# -> a -> State# s -> State# s errorImpossible :: String -> String -> a bool2Int# :: Bool -> Int# int2Bool# :: Int# -> Bool -- | An unsigned integral type that can be losslessly converted to and from -- Ptr. This type is also compatible with the C99 type -- uintptr_t, and can be marshalled to and from that type -- safely. newtype WordPtr WordPtr :: Word -> WordPtr -- | casts a Ptr to a WordPtr ptrToWordPtr :: () => Ptr a -> WordPtr -- | casts a WordPtr to a Ptr wordPtrToPtr :: () => WordPtr -> Ptr a -- | A signed integral type that can be losslessly converted to and from -- Ptr. This type is also compatible with the C99 type -- intptr_t, and can be marshalled to and from that type safely. newtype IntPtr IntPtr :: Int -> IntPtr -- | casts a Ptr to an IntPtr ptrToIntPtr :: () => Ptr a -> IntPtr -- | casts an IntPtr to a Ptr intPtrToPtr :: () => IntPtr -> Ptr a instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b) => Data.Prim.Class.Prim (Data.Either.Either a b) instance Data.Prim.Class.Prim () instance forall k (a :: k) (b :: k). (a Data.Type.Equality.~ b) => Data.Prim.Class.Prim (a Data.Type.Equality.:~: b) instance Data.Prim.Class.Prim GHC.Types.Int instance Data.Prim.Class.Prim GHC.Int.Int8 instance Data.Prim.Class.Prim GHC.Int.Int16 instance Data.Prim.Class.Prim GHC.Int.Int32 instance Data.Prim.Class.Prim GHC.Int.Int64 instance Data.Prim.Class.Prim GHC.Types.Word instance Data.Prim.Class.Prim GHC.Word.Word8 instance Data.Prim.Class.Prim GHC.Word.Word16 instance Data.Prim.Class.Prim GHC.Word.Word32 instance Data.Prim.Class.Prim GHC.Word.Word64 instance Data.Prim.Class.Prim GHC.Types.Float instance Data.Prim.Class.Prim GHC.Types.Double instance Data.Prim.Class.Prim GHC.Types.Bool instance Data.Prim.Class.Prim GHC.Types.Char instance Data.Prim.Class.Prim (GHC.Ptr.Ptr a) instance Data.Prim.Class.Prim (GHC.Ptr.FunPtr a) instance Data.Prim.Class.Prim (GHC.Stable.StablePtr a) instance Data.Prim.Class.Prim Foreign.Ptr.IntPtr instance Data.Prim.Class.Prim Foreign.Ptr.WordPtr instance Data.Prim.Class.Prim Foreign.C.Types.CBool instance Data.Prim.Class.Prim Foreign.C.Types.CChar instance Data.Prim.Class.Prim Foreign.C.Types.CSChar instance Data.Prim.Class.Prim Foreign.C.Types.CUChar instance Data.Prim.Class.Prim Foreign.C.Types.CShort instance Data.Prim.Class.Prim Foreign.C.Types.CUShort instance Data.Prim.Class.Prim Foreign.C.Types.CInt instance Data.Prim.Class.Prim Foreign.C.Types.CUInt instance Data.Prim.Class.Prim Foreign.C.Types.CLong instance Data.Prim.Class.Prim Foreign.C.Types.CULong instance Data.Prim.Class.Prim Foreign.C.Types.CLLong instance Data.Prim.Class.Prim Foreign.C.Types.CULLong instance Data.Prim.Class.Prim Foreign.C.Types.CPtrdiff instance Data.Prim.Class.Prim Foreign.C.Types.CSize instance Data.Prim.Class.Prim Foreign.C.Types.CWchar instance Data.Prim.Class.Prim Foreign.C.Types.CSigAtomic instance Data.Prim.Class.Prim Foreign.C.Types.CIntPtr instance Data.Prim.Class.Prim Foreign.C.Types.CUIntPtr instance Data.Prim.Class.Prim Foreign.C.Types.CIntMax instance Data.Prim.Class.Prim Foreign.C.Types.CUIntMax instance Data.Prim.Class.Prim Foreign.C.Types.CFloat instance Data.Prim.Class.Prim Foreign.C.Types.CDouble instance Data.Prim.Class.Prim System.Posix.Types.Fd instance Data.Prim.Class.Prim Foreign.C.Error.Errno instance Data.Prim.Class.Prim System.Posix.Types.CDev instance Data.Prim.Class.Prim System.Posix.Types.CIno instance Data.Prim.Class.Prim System.Posix.Types.CMode instance Data.Prim.Class.Prim System.Posix.Types.COff instance Data.Prim.Class.Prim System.Posix.Types.CPid instance Data.Prim.Class.Prim System.Posix.Types.CSsize instance Data.Prim.Class.Prim System.Posix.Types.CGid instance Data.Prim.Class.Prim System.Posix.Types.CNlink instance Data.Prim.Class.Prim System.Posix.Types.CUid instance Data.Prim.Class.Prim System.Posix.Types.CCc instance Data.Prim.Class.Prim System.Posix.Types.CSpeed instance Data.Prim.Class.Prim System.Posix.Types.CTcflag instance Data.Prim.Class.Prim System.Posix.Types.CRLim instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Max a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Min a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.First a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Last a) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b) => Data.Prim.Class.Prim (Data.Semigroup.Arg a b) instance forall k a (b :: k). Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Functor.Const.Const a b) instance forall k2 (a :: k2) (b :: k2). (a Data.Type.Equality.~ b) => Data.Prim.Class.Prim (a Data.Type.Equality.:~~: b) instance Data.Prim.Class.Prim System.Posix.Types.CBlkSize instance Data.Prim.Class.Prim System.Posix.Types.CBlkCnt instance Data.Prim.Class.Prim System.Posix.Types.CClockId instance Data.Prim.Class.Prim System.Posix.Types.CFsBlkCnt instance Data.Prim.Class.Prim System.Posix.Types.CFsFilCnt instance Data.Prim.Class.Prim System.Posix.Types.CId instance Data.Prim.Class.Prim System.Posix.Types.CKey instance Data.Prim.Class.Prim System.Posix.Types.CTimer instance forall k (f :: k -> *) (a :: k). Data.Prim.Class.Prim (f a) => Data.Prim.Class.Prim (Data.Monoid.Ap f a) instance forall k (f :: k -> *) (a :: k) (g :: k -> *). (Data.Prim.Class.Prim (f a), Data.Prim.Class.Prim (g a)) => Data.Prim.Class.Prim (Data.Functor.Product.Product f g a) instance forall k1 k (f :: k -> *) (g :: k1 -> k) (a :: k1). Data.Prim.Class.Prim (f (g a)) => Data.Prim.Class.Prim (Data.Functor.Compose.Compose f g a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Functor.Identity.Identity a) instance forall k (f :: k -> *) (a :: k). Data.Prim.Class.Prim (f a) => Data.Prim.Class.Prim (Data.Semigroup.Internal.Alt f a) instance Data.Prim.Class.Prim GHC.Types.Ordering instance Data.Prim.Class.Prim GHC.IO.Device.IODeviceType instance Data.Prim.Class.Prim GHC.IO.Device.SeekMode instance Data.Prim.Class.Prim GHC.Conc.Sync.BlockReason instance Data.Prim.Class.Prim GHC.Conc.Sync.ThreadStatus instance Data.Prim.Class.Prim GHC.IO.IOMode.IOMode instance Data.Prim.Class.Prim GHC.IO.Handle.Types.BufferMode instance Data.Prim.Class.Prim GHC.IO.Handle.Types.Newline instance Data.Prim.Class.Prim GHC.IO.Handle.Types.NewlineMode instance Data.Prim.Class.Prim GHC.Unicode.GeneralCategory instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Ord.Down a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Internal.Dual a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Internal.Sum a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Semigroup.Internal.Product a) instance Data.Prim.Class.Prim Data.Semigroup.Internal.All instance Data.Prim.Class.Prim Data.Semigroup.Internal.Any instance Data.Prim.Class.Prim GHC.Fingerprint.Type.Fingerprint instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (GHC.Real.Ratio a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Complex.Complex a) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b) => Data.Prim.Class.Prim (a, b) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c) => Data.Prim.Class.Prim (a, b, c) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d) => Data.Prim.Class.Prim (a, b, c, d) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d, Data.Prim.Class.Prim e) => Data.Prim.Class.Prim (a, b, c, d, e) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d, Data.Prim.Class.Prim e, Data.Prim.Class.Prim f) => Data.Prim.Class.Prim (a, b, c, d, e, f) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d, Data.Prim.Class.Prim e, Data.Prim.Class.Prim f, Data.Prim.Class.Prim g) => Data.Prim.Class.Prim (a, b, c, d, e, f, g) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d, Data.Prim.Class.Prim e, Data.Prim.Class.Prim f, Data.Prim.Class.Prim g, Data.Prim.Class.Prim h) => Data.Prim.Class.Prim (a, b, c, d, e, f, g, h) instance (Data.Prim.Class.Prim a, Data.Prim.Class.Prim b, Data.Prim.Class.Prim c, Data.Prim.Class.Prim d, Data.Prim.Class.Prim e, Data.Prim.Class.Prim f, Data.Prim.Class.Prim g, Data.Prim.Class.Prim h, Data.Prim.Class.Prim i) => Data.Prim.Class.Prim (a, b, c, d, e, f, g, h, i) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (GHC.Maybe.Maybe a) module Data.Prim.Atomic class (Prim a, Eq a) => Atomic a -- | Read an element from MutableByteArray# atomically. Implies full -- memory barrier. atomicReadMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) -- | Write an element into MutableByteArray# atomically. Implies -- full memory barrier. atomicWriteMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> a -> State# s -> State# s -- | Read an element from memory atomically. Implies full memory barrier. atomicReadOffAddr# :: Atomic a => Addr# -> Int# -> State# s -> (# State# s, a #) -- | Write an element directly into memory atomically. Implies full memory -- barrier. atomicWriteOffAddr# :: Atomic a => Addr# -> Int# -> a -> State# s -> State# s -- | Compare-and-swap (CAS) operation. Given a mutable array, offset in -- number of elements, an old value and a new value atomically swap the -- old value for the new one, but only if the actual old value was an -- exact match to the expetced old one that was supplied. Returns the -- actual old value, which if compared to supplied expected one will tell -- us whether atomic swap occured or not. casMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> a -> a -> State# s -> (# State# s, a #) -- | Compare-and-swap (CAS) operation. Given a mutable array, offset in -- number of elements, an old value and a new value atomically swap the -- old value for the new one, but only if the actual old value was an -- exact match to the expetced old one that was supplied. Returns the -- actual old value, which if compared to supplied expected one will tell -- us whether atomic swap occured or not. casMutableByteArray# :: (Atomic a, Atomic (PrimBase a)) => MutableByteArray# s -> Int# -> a -> a -> State# s -> (# State# s, a #) casOffAddr# :: Atomic a => Addr# -> Int# -> a -> a -> State# s -> (# State# s, a #) casOffAddr# :: (Atomic a, Atomic (PrimBase a)) => Addr# -> Int# -> a -> a -> State# s -> (# State# s, a #) casBoolMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> a -> a -> State# s -> (# State# s, Bool #) casBoolMutableByteArray# :: (Atomic a, Atomic (PrimBase a)) => MutableByteArray# s -> Int# -> a -> a -> State# s -> (# State# s, Bool #) casBoolOffAddr# :: Atomic a => Addr# -> Int# -> a -> a -> State# s -> (# State# s, Bool #) casBoolOffAddr# :: (Atomic a, Atomic (PrimBase a)) => Addr# -> Int# -> a -> a -> State# s -> (# State# s, Bool #) -- | Using casMutableByteArray# perform atomic modification of an -- element in a MutableByteArray#. This is essentially an -- implementation of a spinlock using CAS. atomicModifyMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> (a -> (# a, b #)) -> State# s -> (# State# s, b #) -- | Using casOffAddr# perform atomic modification of an element in -- a OffAddr#. This is essentially an implementation of a -- spinlock using CAS. atomicModifyOffAddr# :: Atomic a => Addr# -> Int# -> (a -> (# a, b #)) -> State# s -> (# State# s, b #) class (Bits a, Atomic a) => AtomicBits a atomicAndFetchOldMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchOldMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewMutableByteArray# :: AtomicBits a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewMutableByteArray# :: (AtomicBits a, AtomicBits (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchOldOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchOldOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewOffAddr# :: AtomicBits a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewOffAddr# :: (AtomicBits a, AtomicBits (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) class Atomic a => AtomicCount a atomicAddFetchOldMutableByteArray# :: AtomicCount a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchOldMutableByteArray# :: (AtomicCount a, AtomicCount (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewMutableByteArray# :: AtomicCount a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewMutableByteArray# :: (AtomicCount a, AtomicCount (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldMutableByteArray# :: AtomicCount a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldMutableByteArray# :: (AtomicCount a, AtomicCount (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewMutableByteArray# :: AtomicCount a => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewMutableByteArray# :: (AtomicCount a, AtomicCount (PrimBase a)) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchOldOffAddr# :: AtomicCount a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchOldOffAddr# :: (AtomicCount a, AtomicCount (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewOffAddr# :: AtomicCount a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewOffAddr# :: (AtomicCount a, AtomicCount (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldOffAddr# :: AtomicCount a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldOffAddr# :: (AtomicCount a, AtomicCount (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewOffAddr# :: AtomicCount a => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewOffAddr# :: (AtomicCount a, AtomicCount (PrimBase a)) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) -- | Using casBoolMutableByteArray# perform atomic modification of -- an element in a MutableByteArray#. This is essentially an -- implementation of a spinlock using CAS. atomicBoolModifyMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> (a -> (# a, b #)) -> State# s -> (# State# s, b #) -- | Using casBoolMutableByteArray# perform atomic modification of -- an element in a MutableByteArray#. Returns the previous value. atomicBoolModifyFetchOldMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> (a -> a) -> State# s -> (# State# s, a #) -- | Using casMutableByteArray# perform atomic modification of an -- element in a MutableByteArray#. atomicModifyMutableByteArray_# :: Atomic a => MutableByteArray# s -> Int# -> (a -> a) -> State# s -> State# s -- | Using casMutableByteArray# perform atomic modification of an -- element in a MutableByteArray#. Returns the previous value. atomicModifyFetchOldMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> (a -> a) -> State# s -> (# State# s, a #) -- | Using casMutableByteArray# perform atomic modification of an -- element in a MutableByteArray#. Returns the new value. atomicModifyFetchNewMutableByteArray# :: Atomic a => MutableByteArray# s -> Int# -> (a -> a) -> State# s -> (# State# s, a #) -- | Using casOffAddr# perform atomic modification of an element in -- a OffAddr#. atomicModifyOffAddr_# :: Atomic a => Addr# -> Int# -> (a -> a) -> State# s -> State# s -- | Using casBoolOffAddr# perform atomic modification of an element -- in a OffAddr#. This is essentially an implementation of a -- spinlock using CAS. atomicBoolModifyOffAddr# :: Atomic a => Addr# -> Int# -> (a -> (# a, b #)) -> State# s -> (# State# s, b #) -- | Using casOffAddr# perform atomic modification of an element in -- a OffAddr#. Returns the previous value. atomicModifyFetchOldOffAddr# :: Atomic a => Addr# -> Int# -> (a -> a) -> State# s -> (# State# s, a #) -- | Using casOffAddr# perform atomic modification of an element in -- a OffAddr#. Returns the new value. atomicModifyFetchNewOffAddr# :: Atomic a => Addr# -> Int# -> (a -> a) -> State# s -> (# State# s, a #) -- | Flip all bits atomically in the element of an array at the supplied -- offset. Returns the previous value. Implies full memory barrier. atomicNotFetchOldMutableByteArray# :: forall a s. AtomicBits a => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) -- | Flip all bits atomically in the element of an array at the supplied -- offset. Returns the new value. Implies full memory barrier. atomicNotFetchNewMutableByteArray# :: forall a s. AtomicBits a => MutableByteArray# s -> Int# -> State# s -> (# State# s, a #) -- | Flip all bits atomically in the element of an array at the supplied -- offset. Returns the previous value. Implies full memory barrier. atomicNotFetchOldOffAddr# :: forall a s. AtomicBits a => Addr# -> Int# -> State# s -> (# State# s, a #) -- | Flip all bits atomically in the element of an array at the supplied -- offset. Returns the new value. Implies full memory barrier. atomicNotFetchNewOffAddr# :: forall a s. AtomicBits a => Addr# -> Int# -> State# s -> (# State# s, a #) instance Data.Prim.Atomic.AtomicBits GHC.Int.Int8 instance Data.Prim.Atomic.AtomicBits GHC.Int.Int16 instance Data.Prim.Atomic.AtomicBits GHC.Int.Int32 instance Data.Prim.Atomic.AtomicBits GHC.Types.Int instance Data.Prim.Atomic.AtomicBits GHC.Word.Word8 instance Data.Prim.Atomic.AtomicBits GHC.Word.Word16 instance Data.Prim.Atomic.AtomicBits GHC.Word.Word32 instance Data.Prim.Atomic.AtomicBits GHC.Types.Word instance Data.Prim.Atomic.AtomicBits GHC.Int.Int64 instance Data.Prim.Atomic.AtomicBits GHC.Word.Word64 instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CLLong instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CULLong instance Data.Prim.Atomic.AtomicBits GHC.Types.Bool instance Data.Prim.Atomic.AtomicBits Foreign.Ptr.IntPtr instance Data.Prim.Atomic.AtomicBits Foreign.Ptr.WordPtr instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CBool instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CChar instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CSChar instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CUChar instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CShort instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CUShort instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CInt instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CUInt instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CLong instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CULong instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CPtrdiff instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CSize instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CWchar instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CSigAtomic instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CIntPtr instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CUIntPtr instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CIntMax instance Data.Prim.Atomic.AtomicBits Foreign.C.Types.CUIntMax instance Data.Prim.Atomic.AtomicBits System.Posix.Types.Fd instance Data.Prim.Atomic.AtomicBits a => Data.Prim.Atomic.AtomicBits (Data.Functor.Const.Const a b) instance Data.Prim.Atomic.AtomicBits a => Data.Prim.Atomic.AtomicBits (Data.Functor.Identity.Identity a) instance Data.Prim.Atomic.AtomicCount GHC.Int.Int8 instance Data.Prim.Atomic.AtomicCount GHC.Int.Int16 instance Data.Prim.Atomic.AtomicCount GHC.Int.Int32 instance Data.Prim.Atomic.AtomicCount GHC.Types.Int instance Data.Prim.Atomic.AtomicCount GHC.Word.Word8 instance Data.Prim.Atomic.AtomicCount GHC.Word.Word16 instance Data.Prim.Atomic.AtomicCount GHC.Word.Word32 instance Data.Prim.Atomic.AtomicCount GHC.Types.Word instance Data.Prim.Atomic.AtomicCount GHC.Int.Int64 instance Data.Prim.Atomic.AtomicCount GHC.Word.Word64 instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CLLong instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CULLong instance Data.Prim.Atomic.AtomicCount Foreign.Ptr.IntPtr instance Data.Prim.Atomic.AtomicCount Foreign.Ptr.WordPtr instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CBool instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CChar instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CSChar instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CUChar instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CShort instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CUShort instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CInt instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CUInt instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CLong instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CULong instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CPtrdiff instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CSize instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CWchar instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CSigAtomic instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CIntPtr instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CUIntPtr instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CIntMax instance Data.Prim.Atomic.AtomicCount Foreign.C.Types.CUIntMax instance Data.Prim.Atomic.AtomicCount System.Posix.Types.Fd instance Data.Prim.Atomic.AtomicCount Foreign.C.Error.Errno instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Functor.Const.Const a b) instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Functor.Identity.Identity a) instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Ord.Down a) instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Semigroup.Internal.Dual a) instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Semigroup.Internal.Sum a) instance Data.Prim.Atomic.AtomicCount a => Data.Prim.Atomic.AtomicCount (Data.Semigroup.Internal.Product a) instance Data.Prim.Atomic.Atomic GHC.Int.Int8 instance Data.Prim.Atomic.Atomic GHC.Int.Int16 instance Data.Prim.Atomic.Atomic GHC.Int.Int32 instance Data.Prim.Atomic.Atomic GHC.Types.Int instance Data.Prim.Atomic.Atomic GHC.Word.Word8 instance Data.Prim.Atomic.Atomic GHC.Word.Word16 instance Data.Prim.Atomic.Atomic GHC.Word.Word32 instance Data.Prim.Atomic.Atomic GHC.Types.Word instance Data.Prim.Atomic.Atomic GHC.Int.Int64 instance Data.Prim.Atomic.Atomic GHC.Word.Word64 instance Data.Prim.Atomic.Atomic Foreign.C.Types.CLLong instance Data.Prim.Atomic.Atomic Foreign.C.Types.CULLong instance Data.Prim.Atomic.Atomic GHC.Types.Bool instance Data.Prim.Atomic.Atomic GHC.Types.Char instance Data.Prim.Atomic.Atomic (GHC.Ptr.Ptr a) instance Data.Prim.Atomic.Atomic (GHC.Ptr.FunPtr a) instance Data.Prim.Atomic.Atomic Foreign.Ptr.IntPtr instance Data.Prim.Atomic.Atomic Foreign.Ptr.WordPtr instance Data.Prim.Atomic.Atomic Foreign.C.Types.CBool instance Data.Prim.Atomic.Atomic Foreign.C.Types.CChar instance Data.Prim.Atomic.Atomic Foreign.C.Types.CSChar instance Data.Prim.Atomic.Atomic Foreign.C.Types.CUChar instance Data.Prim.Atomic.Atomic Foreign.C.Types.CShort instance Data.Prim.Atomic.Atomic Foreign.C.Types.CUShort instance Data.Prim.Atomic.Atomic Foreign.C.Types.CInt instance Data.Prim.Atomic.Atomic Foreign.C.Types.CUInt instance Data.Prim.Atomic.Atomic Foreign.C.Types.CLong instance Data.Prim.Atomic.Atomic Foreign.C.Types.CULong instance Data.Prim.Atomic.Atomic Foreign.C.Types.CPtrdiff instance Data.Prim.Atomic.Atomic Foreign.C.Types.CSize instance Data.Prim.Atomic.Atomic Foreign.C.Types.CWchar instance Data.Prim.Atomic.Atomic Foreign.C.Types.CSigAtomic instance Data.Prim.Atomic.Atomic Foreign.C.Types.CIntPtr instance Data.Prim.Atomic.Atomic Foreign.C.Types.CUIntPtr instance Data.Prim.Atomic.Atomic Foreign.C.Types.CIntMax instance Data.Prim.Atomic.Atomic Foreign.C.Types.CUIntMax instance Data.Prim.Atomic.Atomic System.Posix.Types.Fd instance Data.Prim.Atomic.Atomic Foreign.C.Error.Errno instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Max a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Min a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.First a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Last a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Functor.Const.Const a b) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Functor.Identity.Identity a) instance Data.Prim.Atomic.Atomic GHC.Types.Ordering instance Data.Prim.Atomic.Atomic GHC.IO.Device.IODeviceType instance Data.Prim.Atomic.Atomic GHC.IO.Device.SeekMode instance Data.Prim.Atomic.Atomic GHC.Conc.Sync.BlockReason instance Data.Prim.Atomic.Atomic GHC.Conc.Sync.ThreadStatus instance Data.Prim.Atomic.Atomic GHC.IO.IOMode.IOMode instance Data.Prim.Atomic.Atomic GHC.IO.Handle.Types.Newline instance Data.Prim.Atomic.Atomic GHC.IO.Handle.Types.NewlineMode instance Data.Prim.Atomic.Atomic GHC.Unicode.GeneralCategory instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Ord.Down a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Internal.Dual a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Internal.Sum a) instance Data.Prim.Atomic.Atomic a => Data.Prim.Atomic.Atomic (Data.Semigroup.Internal.Product a) instance Data.Prim.Atomic.Atomic Data.Semigroup.Internal.All instance Data.Prim.Atomic.Atomic Data.Semigroup.Internal.Any module Data.Prim.Atom newtype Atom a Atom :: a -> Atom a [unAtom] :: Atom a -> a acquireLockByteOffMutableByteArray :: MutableByteArray# RealWorld -> Int# -> IO () releaseLockByteOffMutableByteArray :: MutableByteArray# RealWorld -> Int# -> IO () acquireLockByteOffAddr :: Addr# -> Int# -> IO () releaseLockByteOffAddr :: Addr# -> Int# -> IO () withLockMutableByteArray :: forall e b. Prim e => MutableByteArray# RealWorld -> Int# -> (Atom e -> IO (Atom e, b)) -> IO b withLockOffAddr :: forall e b. Prim e => Addr# -> Int# -> (Atom e -> IO (Atom e, b)) -> IO b atomicAddFetchOldMutableByteArrayNum# :: (Num a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewMutableByteArrayNum# :: (Num a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldMutableByteArrayNum# :: (Num a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewMutableByteArrayNum# :: (Num a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchOldOffAddrNum# :: (Num a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAddFetchNewOffAddrNum# :: (Num a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchOldOffAddrNum# :: (Num a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicSubFetchNewOffAddrNum# :: (Num a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchOldMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewMutableByteArrayBits# :: (Bits a, Atomic a) => MutableByteArray# s -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchOldOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicAndFetchNewOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchOldOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicNandFetchNewOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchOldOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicOrFetchNewOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchOldOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) atomicXorFetchNewOffAddrBits# :: (Bits a, Atomic a) => Addr# -> Int# -> a -> State# s -> (# State# s, a #) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Prim.Atom.Atom a) instance Data.Bits.Bits a => Data.Bits.Bits (Data.Prim.Atom.Atom a) instance GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Prim.Atom.Atom a) instance GHC.Float.Floating a => GHC.Float.Floating (Data.Prim.Atom.Atom a) instance GHC.Real.Fractional a => GHC.Real.Fractional (Data.Prim.Atom.Atom a) instance GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Prim.Atom.Atom a) instance GHC.Real.Real a => GHC.Real.Real (Data.Prim.Atom.Atom a) instance GHC.Real.Integral a => GHC.Real.Integral (Data.Prim.Atom.Atom a) instance GHC.Enum.Enum a => GHC.Enum.Enum (Data.Prim.Atom.Atom a) instance GHC.Num.Num a => GHC.Num.Num (Data.Prim.Atom.Atom a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Prim.Atom.Atom a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Prim.Atom.Atom a) instance GHC.Show.Show a => GHC.Show.Show (Data.Prim.Atom.Atom a) instance Data.Prim.Class.Prim a => Data.Prim.Class.Prim (Data.Prim.Atom.Atom a) instance (GHC.Classes.Eq a, Data.Prim.Class.Prim a) => Data.Prim.Atomic.Atomic (Data.Prim.Atom.Atom a) instance (GHC.Num.Num a, GHC.Classes.Eq a, Data.Prim.Class.Prim a) => Data.Prim.Atomic.AtomicCount (Data.Prim.Atom.Atom a) instance (Data.Bits.Bits a, GHC.Classes.Eq a, Data.Prim.Class.Prim a) => Data.Prim.Atomic.AtomicBits (Data.Prim.Atom.Atom a) module Data.Prim -- | Invariants: -- -- class Prim a newtype Atom a Atom :: a -> Atom a [unAtom] :: Atom a -> a class (Prim a, Eq a) => Atomic a class Atomic a => AtomicCount a class (Bits a, Atomic a) => AtomicBits a class MonadThrow m => MonadPrim s m | m -> s -- | A shorter synonym for the magical RealWorld type RW = RealWorld -- | RealWorld is deeply magical. It is primitive, but it -- is not unlifted (hence ptrArg). We never manipulate -- values of type RealWorld; it's only used in the type system, -- to parameterise State#. data RealWorld :: Type -- | Get the size of the data type in bytes. Argument is not evaluated. -- --
--   >>> import Data.Prim
--   
--   >>> byteCount (Just 'a')
--   Count {unCount = 5}
--   
byteCount :: forall e. Prim e => e -> Count Word8 -- | Same as sizeOf, except that the type can be supplied as a -- type level argument -- --
--   >>> :set -XTypeApplications
--   
--   >>> import Data.Prim
--   
--   >>> byteCountType @Int64
--   Count {unCount = 8}
--   
byteCountType :: forall e. Prim e => Count Word8 -- | Same as sizeOf, but argument is a Proxy of a, -- instead of the type itself. -- --
--   >>> import Data.Prim
--   
--   >>> import Data.Proxy
--   
--   >>> byteCountProxy (Proxy :: Proxy Int64)
--   Count {unCount = 8}
--   
byteCountProxy :: forall proxy e. Prim e => proxy e -> Count Word8 -- | Get the alignemnt of the type in bytes. Argument is not evaluated. alignment :: forall e. Prim e => e -> Int -- | Same as alignment, except that the type can be supplied with -- TypeApplications -- --
--   >>> :set -XTypeApplications
--   
--   >>> import Data.Prim
--   
--   >>> alignmentType @Int32
--   4
--   
alignmentType :: forall e. Prim e => Int -- | Same as alignment, but argument is a Proxy of -- a, instead of the type itself. -- --
--   >>> import Data.Proxy
--   
--   >>> alignmentProxy (Proxy :: Proxy Int64)
--   8
--   
alignmentProxy :: forall proxy e. Prim e => proxy e -> Int newtype Size Size :: Int -> Size [unSize] :: Size -> Int -- | Number of elements newtype Count e Count :: Int -> Count e [unCount] :: Count e -> Int -- | Covert an element count to number of bytes it coresponds to as an -- Int. See toByteCount for preserving the Count -- wrapper. unCountBytes :: Prim e => Count e -> Int -- | Covert to the Count of bytes toByteCount :: Prim e => Count e -> Count Word8 unCountBytes# :: Prim e => Count e -> Int# -- | Compute how many elements of type e can fit in the supplied -- number of bytes. fromByteCount :: forall e. Prim e => Count Word8 -> Count e fromByteCountRem :: forall e. Prim e => Count Word8 -> (Count e, Count Word8) -- | Cast a count to an offset of the same type countToOff :: Count e -> Off e countToByteOff :: Prim e => Count e -> Off Word8 -- | Restrict type argument of Count to the same type as the second -- argument, which itself is not evaluated countForType :: Count e -> e -> Count e -- | Helper noop function that restricts Count to the type of proxy countForProxyTypeOf :: Count e -> proxy e -> Count e -- | Offset in number of elements newtype Off e Off :: Int -> Off e [unOff] :: Off e -> Int -- | Convert an offset for some type e with Prim instance -- to the number of bytes as an Int. -- --
--   >>> unOffBytes (10 :: Off Word64)
--   80
--   
unOffBytes :: Prim e => Off e -> Int -- | Compute byte offset from an offset of Prim type -- --
--   >>> toByteOff (10 :: Off Word64)
--   Off {unOff = 80}
--   
toByteOff :: Prim e => Off e -> Off Word8 -- | Convert offset of some type into number of bytes unOffBytes# :: Prim e => Off e -> Int# fromByteOff :: forall e. Prim e => Off Word8 -> Off e fromByteOffRem :: forall e. Prim e => Off Word8 -> (Off e, Off Word8) -- | Cast an offset to count. Useful for dealing with regions. -- --
--   >>> import Data.Prim
--   
--   >>> totalCount = Count 10 :: Count Word
--   
--   >>> startOffset = Off 4 :: Off Word
--   
--   >>> totalCount - offToCount startOffset
--   Count {unCount = 6}
--   
offToCount :: Off e -> Count e -- | Convert an offset in elements to count in bytres. offToByteCount :: Prim e => Off e -> Count Word8 -- | Restrict type argument of Off to the same type as the second -- argument, which itself is not evaluated offForType :: Off e -> e -> Off e -- | Helper noop function that restricts Offset to the type of proxy offForProxyTypeOf :: Off e -> proxy e -> Off e prefetchValue0 :: MonadPrim s m => a -> m () prefetchValue1 :: MonadPrim s m => a -> m () prefetchValue2 :: MonadPrim s m => a -> m () prefetchValue3 :: MonadPrim s m => a -> m () -- | A value of type Ptr a represents a pointer to an -- object, or an array of objects, which may be marshalled to or from -- Haskell values of type a. -- -- The type a will often be an instance of class Storable -- which provides the marshalling operations. However this is not -- essential, and you can provide your own operations to access the -- pointer. For example you might write small foreign functions to get or -- set the fields of a C struct. data Ptr a -- | The type ForeignPtr represents references to objects that are -- maintained in a foreign language, i.e., that are not part of the data -- structures usually managed by the Haskell storage manager. The -- essential difference between ForeignPtrs and vanilla memory -- references of type Ptr a is that the former may be associated -- with finalizers. A finalizer is a routine that is invoked when -- the Haskell storage manager detects that - within the Haskell heap and -- stack - there are no more references left that are pointing to the -- ForeignPtr. Typically, the finalizer will, then, invoke -- routines in the foreign language that free the resources bound by the -- foreign object. -- -- The ForeignPtr is parameterised in the same way as Ptr. -- The type argument of ForeignPtr should normally be an instance -- of class Storable. data ForeignPtr a -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable (a :: k) -- | Proxy is a type that holds no data, but has a phantom parameter -- of arbitrary type (or even kind). Its use is to provide type -- information, even though there is no value available of that type (or -- it may be too costly to create one). -- -- Historically, Proxy :: Proxy a is a safer -- alternative to the 'undefined :: a' idiom. -- --
--   >>> Proxy :: Proxy (Void, Int -> Int)
--   Proxy
--   
-- -- Proxy can even hold types of higher kinds, -- --
--   >>> Proxy :: Proxy Either
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy Functor
--   Proxy
--   
-- --
--   >>> Proxy :: Proxy complicatedStructure
--   Proxy
--   
data Proxy (t :: k) :: forall k. () => k -> Type Proxy :: Proxy -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- -- -- -- The method names refer to the monoid of lists under concatenation, but -- there are many other instances. -- -- Some types can be viewed as a monoid in more than one way, e.g. both -- addition and multiplication on numbers. In such cases we often define -- newtypes and make those instances of Monoid, e.g. -- Sum and Product. -- -- NOTE: Semigroup is a superclass of Monoid since -- base-4.11.0.0. class Semigroup a => Monoid a -- | Identity of mappend mempty :: Monoid a => a -- | An associative operation -- -- NOTE: This method is redundant and has the default -- implementation mappend = '(<>)' since -- base-4.11.0.0. mappend :: Monoid a => a -> a -> a -- | Fold a list using the monoid. -- -- For most types, the default definition for mconcat will be -- used, but the function is included in the class definition so that an -- optimized version can be provided for specific types. mconcat :: Monoid a => [a] -> a -- | This data type witnesses the lifting of a Monoid into an -- Applicative pointwise. newtype Ap (f :: k -> Type) (a :: k) :: forall k. () => k -> Type -> k -> Type Ap :: f a -> Ap [getAp] :: Ap -> f a -- | The dual of a Monoid, obtained by swapping the arguments of -- mappend. -- --
--   >>> getDual (mappend (Dual "Hello") (Dual "World"))
--   "WorldHello"
--   
newtype Dual a Dual :: a -> Dual a [getDual] :: Dual a -> a -- | The monoid of endomorphisms under composition. -- --
--   >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--   
--   >>> appEndo computation "Haskell"
--   "Hello, Haskell!"
--   
newtype Endo a Endo :: (a -> a) -> Endo a [appEndo] :: Endo a -> a -> a -- | Boolean monoid under conjunction (&&). -- --
--   >>> getAll (All True <> mempty <> All False)
--   False
--   
-- --
--   >>> getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))
--   False
--   
newtype All All :: Bool -> All [getAll] :: All -> Bool -- | Boolean monoid under disjunction (||). -- --
--   >>> getAny (Any True <> mempty <> Any False)
--   True
--   
-- --
--   >>> getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8]))
--   True
--   
newtype Any Any :: Bool -> Any [getAny] :: Any -> Bool -- | Monoid under addition. -- --
--   >>> getSum (Sum 1 <> Sum 2 <> mempty)
--   3
--   
newtype Sum a Sum :: a -> Sum a [getSum] :: Sum a -> a -- | Monoid under multiplication. -- --
--   >>> getProduct (Product 3 <> Product 4 <> mempty)
--   12
--   
newtype Product a Product :: a -> Product a [getProduct] :: Product a -> a -- | Monoid under <|>. newtype Alt (f :: k -> Type) (a :: k) :: forall k. () => k -> Type -> k -> Type Alt :: f a -> Alt [getAlt] :: Alt -> f a instance Control.DeepSeq.NFData (Data.Prim.Off e) instance GHC.Real.Real (Data.Prim.Off e) instance GHC.Real.Integral (Data.Prim.Off e) instance GHC.Num.Num (Data.Prim.Off e) instance GHC.Enum.Bounded (Data.Prim.Off e) instance GHC.Enum.Enum (Data.Prim.Off e) instance GHC.Classes.Ord (Data.Prim.Off e) instance GHC.Show.Show (Data.Prim.Off e) instance GHC.Classes.Eq (Data.Prim.Off e) instance Control.DeepSeq.NFData (Data.Prim.Count e) instance GHC.Real.Real (Data.Prim.Count e) instance GHC.Real.Integral (Data.Prim.Count e) instance GHC.Num.Num (Data.Prim.Count e) instance GHC.Enum.Bounded (Data.Prim.Count e) instance GHC.Enum.Enum (Data.Prim.Count e) instance GHC.Classes.Ord (Data.Prim.Count e) instance GHC.Show.Show (Data.Prim.Count e) instance GHC.Classes.Eq (Data.Prim.Count e) instance GHC.Enum.Enum Data.Prim.Size instance GHC.Enum.Bounded Data.Prim.Size instance GHC.Real.Integral Data.Prim.Size instance GHC.Real.Real Data.Prim.Size instance GHC.Num.Num Data.Prim.Size instance GHC.Classes.Ord Data.Prim.Size instance GHC.Classes.Eq Data.Prim.Size instance GHC.Show.Show Data.Prim.Size instance Data.Prim.Class.Prim (Data.Prim.Off e) instance Data.Prim.Class.Prim (Data.Prim.Count e) module Foreign.Prim.Ptr plusOffPtr :: Prim e => Ptr e -> Off e -> Ptr e plusByteOffPtr :: Ptr e -> Off Word8 -> Ptr e -- | Find 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. minusOffPtr :: Prim e => Ptr e -> Ptr e -> Off e -- | Same as minusOffPtr, but will also return the remainder in -- bytes that is left over. minusOffRemPtr :: Prim e => Ptr e -> Ptr e -> (Off e, Off Word8) -- | Find the offset in bytes that is between the two pointers by -- subtracting one address from another. minusByteOffPtr :: Ptr e -> Ptr e -> Off Word8 readPtr :: (MonadPrim s m, Prim e) => Ptr e -> m e readOffPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> m e readByteOffPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off Word8 -> m e writePtr :: (MonadPrim s m, Prim e) => Ptr e -> e -> m () writeOffPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> e -> m () writeByteOffPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off Word8 -> e -> m () setOffPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> Count e -> e -> m () copyPtrToPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> Ptr e -> Off e -> Count e -> m () copyByteOffPtrToPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off Word8 -> Ptr e -> Off Word8 -> Count e -> m () movePtrToPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> Ptr e -> Off e -> Count e -> m () moveByteOffPtrToPtr :: (MonadPrim s m, Prim e) => Ptr e -> Off Word8 -> Ptr e -> Off Word8 -> Count e -> m () -- | Compare memory between two pointers. Offsets and count is in number of -- elements, instead of byte count. Use compareByteOffPtrToPtr -- when offset in bytes is required. comparePtrToPtr :: Prim e => Ptr e -> Off e -> Ptr e -> Off e -> Count e -> Ordering -- | Same as comparePtrToPtr, except offset is in bytes instead of -- number of elements. compareByteOffPtrToPtr :: Prim e => Ptr e -> Off Word8 -> Ptr e -> Off Word8 -> Count e -> Ordering -- | Same as freeHaskellFunPtr freeHaskellFunPtr :: MonadPrim s m => FunPtr a -> m () -- | A value of type Ptr a represents a pointer to an -- object, or an array of objects, which may be marshalled to or from -- Haskell values of type a. -- -- The type a will often be an instance of class Storable -- which provides the marshalling operations. However this is not -- essential, and you can provide your own operations to access the -- pointer. For example you might write small foreign functions to get or -- set the fields of a C struct. data Ptr a -- | A value of type FunPtr a is a pointer to a function -- callable from foreign code. The type a will normally be a -- foreign type, a function type with zero or more arguments where -- -- -- -- A value of type FunPtr a may be a pointer to a foreign -- function, either returned by another foreign function or imported with -- a a static address import like -- --
--   foreign import ccall "stdlib.h &free"
--     p_free :: FunPtr (Ptr a -> IO ())
--   
-- -- or a pointer to a Haskell function created using a wrapper stub -- declared to produce a FunPtr of the correct type. For example: -- --
--   type Compare = Int -> Int -> Bool
--   foreign import ccall "wrapper"
--     mkCompare :: Compare -> IO (FunPtr Compare)
--   
-- -- Calls to wrapper stubs like mkCompare allocate storage, which -- should be released with freeHaskellFunPtr when no longer -- required. -- -- To convert FunPtr values to corresponding Haskell functions, -- one can define a dynamic stub for the specific foreign type, -- e.g. -- --
--   type IntFunction = CInt -> IO ()
--   foreign import ccall "dynamic"
--     mkFun :: FunPtr IntFunction -> IntFunction
--   
data FunPtr a -- | Casts a Ptr to a FunPtr. -- -- Note: this is valid only on architectures where data and -- function pointers range over the same set of addresses, and should -- only be used for bindings to external libraries whose interface -- already relies on this assumption. castPtrToFunPtr :: () => Ptr a -> FunPtr b -- | Casts a FunPtr to a Ptr. -- -- Note: this is valid only on architectures where data and -- function pointers range over the same set of addresses, and should -- only be used for bindings to external libraries whose interface -- already relies on this assumption. castFunPtrToPtr :: () => FunPtr a -> Ptr b -- | Casts a FunPtr to a FunPtr of a different type. castFunPtr :: () => FunPtr a -> FunPtr b -- | The constant nullFunPtr contains a distinguished value of -- FunPtr that is not associated with a valid memory location. nullFunPtr :: () => FunPtr a -- | Computes the offset required to get from the second to the first -- argument. We have -- --
--   p2 == p1 `plusPtr` (p2 `minusPtr` p1)
--   
minusPtr :: () => Ptr a -> Ptr b -> Int -- | Given an arbitrary address and an alignment constraint, -- alignPtr yields the next higher address that fulfills the -- alignment constraint. An alignment constraint x is fulfilled -- by any address divisible by x. This operation is idempotent. alignPtr :: () => Ptr a -> Int -> Ptr a -- | Advances the given address by the given offset in bytes. plusPtr :: () => Ptr a -> Int -> Ptr b -- | The castPtr function casts a pointer from one type to another. castPtr :: () => Ptr a -> Ptr b -- | The constant nullPtr contains a distinguished value of -- Ptr that is not associated with a valid memory location. nullPtr :: () => Ptr a -- | An unsigned integral type that can be losslessly converted to and from -- Ptr. This type is also compatible with the C99 type -- uintptr_t, and can be marshalled to and from that type -- safely. newtype WordPtr WordPtr :: Word -> WordPtr -- | casts a Ptr to a WordPtr ptrToWordPtr :: () => Ptr a -> WordPtr -- | casts a WordPtr to a Ptr wordPtrToPtr :: () => WordPtr -> Ptr a -- | A signed integral type that can be losslessly converted to and from -- Ptr. This type is also compatible with the C99 type -- intptr_t, and can be marshalled to and from that type safely. newtype IntPtr IntPtr :: Int -> IntPtr -- | casts a Ptr to an IntPtr ptrToIntPtr :: () => Ptr a -> IntPtr -- | casts an IntPtr to a Ptr intPtrToPtr :: () => IntPtr -> Ptr a -- | Perform atomic modification of an element in the Ptr 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. casOffPtr :: (MonadPrim s m, Atomic e) => Ptr e -> Off e -> e -> e -> m e -- | Perform atomic modification of an element in the Ptr 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. atomicModifyOffPtr :: (MonadPrim s m, Atomic e) => Ptr e -> Off e -> (e -> (e, b)) -> m b -- | Perform atomic modification of an element in the Ptr 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. atomicModifyOffPtr_ :: (MonadPrim s m, Atomic e) => Ptr e -> Off e -> (e -> e) -> m () -- | Perform atomic modification of an element in the Ptr 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. atomicModifyFetchOldOffPtr :: (MonadPrim s m, Atomic e) => Ptr e -> Off e -> (e -> e) -> m e -- | Perform atomic modification of an element in the Ptr 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. atomicModifyFetchNewOffPtr :: (MonadPrim s m, Atomic e) => Ptr e -> Off e -> (e -> e) -> m e -- | Add a numeric value to an element of a Ptr, 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. atomicAddFetchOldOffPtr :: (MonadPrim s m, AtomicCount e) => Ptr e -> Off e -> e -> m e -- | Add a numeric value to an element of a Ptr, 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. atomicAddFetchNewOffPtr :: (MonadPrim s m, AtomicCount e) => Ptr e -> Off e -> e -> m e -- | Subtract a numeric value from an element of a Ptr, 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. atomicSubFetchOldOffPtr :: (MonadPrim s m, AtomicCount e) => Ptr e -> Off e -> e -> m e -- | Subtract a numeric value from an element of a Ptr, 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. atomicSubFetchNewOffPtr :: (MonadPrim s m, AtomicCount e) => Ptr e -> Off e -> e -> m e -- | Binary conjunction (AND) of an element of a Ptr 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. atomicAndFetchOldOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary conjunction (AND) of an element of a Ptr 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. atomicAndFetchNewOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Negation of binary conjunction (NAND) of an element of a Ptr -- with the supplied value, corresponds to \x y -> -- complement (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. atomicNandFetchOldOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Negation of binary conjunction (NAND) of an element of a Ptr -- with the supplied value, corresponds to \x y -> -- complement (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. atomicNandFetchNewOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary disjunction (OR) of an element of a Ptr 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. atomicOrFetchOldOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary disjunction (OR) of an element of a Ptr 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. atomicOrFetchNewOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary exclusive disjunction (XOR) of an element of a Ptr with -- the supplied value, corresponds to xor 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. atomicXorFetchOldOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary exclusive disjunction (XOR) of an element of a Ptr with -- the supplied value, corresponds to xor 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. atomicXorFetchNewOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> e -> m e -- | Binary negation (NOT) of an element of a Ptr, corresponds to -- (complement) 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. atomicNotFetchOldOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> m e -- | Binary negation (NOT) of an element of a Ptr, corresponds to -- (complement) 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. atomicNotFetchNewOffPtr :: (MonadPrim s m, AtomicBits e) => Ptr e -> Off e -> m e prefetchPtr0 :: MonadPrim s m => Ptr e -> m () prefetchPtr1 :: MonadPrim s m => Ptr a -> m () prefetchPtr2 :: MonadPrim s m => Ptr e -> m () prefetchPtr3 :: MonadPrim s m => Ptr e -> m () prefetchOffPtr0 :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> m () prefetchOffPtr1 :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> m () prefetchOffPtr2 :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> m () prefetchOffPtr3 :: (MonadPrim s m, Prim e) => Ptr e -> Off e -> m () module Foreign.Prim.StablePtr -- | A stable pointer is a reference to a Haskell expression that is -- guaranteed not to be affected by garbage collection, i.e., it will -- neither be deallocated nor will the value of the stable pointer itself -- change during garbage collection (ordinary references may be relocated -- during garbage collection). Consequently, stable pointers can be -- passed to foreign code, which can treat it as an opaque reference to a -- Haskell value. -- -- A value of type StablePtr a is a stable pointer to a Haskell -- expression of type a. data StablePtr a StablePtr :: StablePtr# a -> StablePtr a -- | Same as newStablePtr, but generalized to MonadPrim newStablePtr :: MonadPrim RW m => a -> m (StablePtr a) -- | Same as deRefStablePtr, but generalized to MonadPrim deRefStablePtr :: MonadPrim RW m => StablePtr a -> m a -- | Same as freeStablePtr, but generalized to MonadPrim freeStablePtr :: MonadPrim RW m => StablePtr a -> m () -- | Coerce a stable pointer to an address. No guarantees are made about -- the resulting value, except that the original stable pointer can be -- recovered by castPtrToStablePtr. In particular, the address may -- not refer to an accessible memory location and any attempt to pass it -- to the member functions of the class Storable leads to -- undefined behaviour. castStablePtrToPtr :: () => StablePtr a -> Ptr () -- | The inverse of castStablePtrToPtr, i.e., we have the identity -- --
--   sp == castPtrToStablePtr (castStablePtrToPtr sp)
--   
-- -- for any stable pointer sp on which freeStablePtr has -- not been executed yet. Moreover, castPtrToStablePtr may only be -- applied to pointers that have been produced by -- castStablePtrToPtr. castPtrToStablePtr :: () => Ptr () -> StablePtr a instance Control.DeepSeq.NFData (GHC.Stable.StablePtr a) instance GHC.Show.Show (GHC.Stable.StablePtr a) module Foreign.Prim.WeakPtr -- | A weak pointer object with a key and a value. The value has type -- v. -- -- A weak pointer expresses a relationship between two objects, the -- key and the value: if the key is considered to be alive -- by the garbage collector, then the value is also alive. A reference -- from the value to the key does not keep the key alive. -- -- A weak pointer may also have a finalizer of type IO (); if it -- does, then the finalizer will be run at most once, at a time after the -- key has become unreachable by the program ("dead"). The storage -- manager attempts to run the finalizer(s) for an object soon after the -- object dies, but promptness is not guaranteed. -- -- It is not guaranteed that a finalizer will eventually run, and no -- attempt is made to run outstanding finalizers when the program exits. -- Therefore finalizers should not be relied on to clean up resources - -- other methods (eg. exception handlers) should be employed, possibly in -- addition to finalizers. -- -- References from the finalizer to the key are treated in the same way -- as references from the value to the key: they do not keep the key -- alive. A finalizer may therefore ressurrect the key, perhaps by -- storing it in the same data structure. -- -- The finalizer, and the relationship between the key and the value, -- exist regardless of whether the program keeps a reference to the -- Weak object or not. -- -- There may be multiple weak pointers with the same key. In this case, -- the finalizers for each of these weak pointers will all be run in some -- arbitrary order, or perhaps concurrently, when the key dies. If the -- programmer specifies a finalizer that assumes it has the only -- reference to an object (for example, a file that it wishes to close), -- then the programmer must ensure that there is only one such finalizer. -- -- If there are no other threads to run, the runtime system will check -- for runnable finalizers before declaring the system to be deadlocked. -- -- WARNING: weak pointers to ordinary non-primitive Haskell types are -- particularly fragile, because the compiler is free to optimise away or -- duplicate the underlying data structure. Therefore attempting to place -- a finalizer on an ordinary Haskell type may well result in the -- finalizer running earlier than you expected. This is not a problem for -- caches and memo tables where early finalization is benign. -- -- Finalizers can be used reliably for types that are created -- explicitly and have identity, such as IORef and -- MVar. However, to place a finalizer on one of these types, -- you should use the specific operation provided for that type, e.g. -- mkWeakIORef and addMVarFinalizer respectively (the -- non-uniformity is accidental). These operations attach the finalizer -- to the primitive object inside the box (e.g. MutVar# in the -- case of IORef), because attaching the finalizer to the box -- itself fails when the outer box is optimised away by the compiler. data Weak v Weak :: Weak# v -> Weak v -- | Same as mkWeak, except it requires a finalizer to be supplied. -- For a version without finalizers use mkWeakNoFinalizer mkWeak :: MonadUnliftPrim RW m => a -> v -> m b -> m (Weak v) -- | Similar to mkWeak, except it does not require a finalizer. mkWeakNoFinalizer :: MonadPrim RW m => a -> v -> m (Weak v) -- | Same as mkWeakPtr, except it requires a finalizer to be -- supplied. For a version without finalizers use -- mkWeakPtrNoFinalizer mkWeakPtr :: MonadUnliftPrim RW m => k -> m b -> m (Weak k) -- | Similar to mkWeakPtr, except it does not require a finalizer. mkWeakPtrNoFinalizer :: MonadPrim RW m => k -> m (Weak k) -- | Same as addFinalizer. addFinalizer :: MonadUnliftPrim RW m => k -> m b -> m () -- | Add a foreign function finalizer with a single argument addCFinalizer :: MonadPrim RW m => FunPtr (Ptr a -> IO ()) -> Ptr a -> Weak v -> m Bool -- | Add a foreign function finalizer with two arguments addCFinalizerEnv :: MonadPrim RW m => FunPtr (Ptr env -> Ptr a -> IO ()) -> Ptr env -> Ptr a -> Weak v -> m Bool -- | Similar to deRefWeak deRefWeak :: MonadPrim RW m => Weak v -> m (Maybe v) -- | Similar to finalize finalizeWeak :: MonadPrim RW m => Weak v -> m ()