effectful-core-2.3.0.0: An easy to use, performant extensible effects library.
Safe HaskellNone
LanguageHaskell2010

Effectful.Internal.Utils

Synopsis

Documentation

inlineBracket :: IO a -> (a -> IO b) -> (a -> IO c) -> IO c Source #

Version of bracket with an INLINE pragma to work around https://gitlab.haskell.org/ghc/ghc/-/issues/22824.

Utils for ThreadId

weakThreadId :: ThreadId -> Int Source #

Get an id of a thread that doesn't prevent its garbage collection.

Utils for Any

type family Any :: k where ... #

The type constructor Any is type to which you can unsafely coerce any lifted type, and back. More concretely, for a lifted type t and value x :: t, -- unsafeCoerce (unsafeCoerce x :: Any) :: t is equivalent to x.

toAny :: a -> Any Source #

Strict IORef

data IORef' a Source #

A strict variant of IORef.

Instances

Instances details
Eq (IORef' a) Source # 
Instance details

Defined in Effectful.Internal.Utils

Methods

(==) :: IORef' a -> IORef' a -> Bool #

(/=) :: IORef' a -> IORef' a -> Bool #

newIORef' :: a -> IO (IORef' a) Source #

writeIORef' :: IORef' a -> a -> IO () Source #

Strict MVar

data MVar' a Source #

A strict variant of MVar.

Instances

Instances details
Eq (MVar' a) Source # 
Instance details

Defined in Effectful.Internal.Utils

Methods

(==) :: MVar' a -> MVar' a -> Bool #

(/=) :: MVar' a -> MVar' a -> Bool #

toMVar' :: MVar a -> IO (MVar' a) Source #

newMVar' :: a -> IO (MVar' a) Source #

modifyMVar' :: MVar' a -> (a -> IO (a, r)) -> IO r Source #

modifyMVar_' :: MVar' a -> (a -> IO a) -> IO () Source #

Unique

data Unique Source #

A unique with no possibility for CAS contention.

Credits for this go to Edward Kmett.

Instances

Instances details
Eq Unique Source # 
Instance details

Defined in Effectful.Internal.Utils

Methods

(==) :: Unique -> Unique -> Bool #

(/=) :: Unique -> Unique -> Bool #