| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Effectful.IORef.Static
Contents
Description
Provides a static effect for IORef.
Since: 0.1
Synopsis
- data IORefE (a :: Type -> Type) b
- newIORef :: forall (es :: [Effect]) a. IORefE :> es => a -> Eff es (IORef a)
- newIORef' :: forall (es :: [Effect]) a. IORefE :> es => a -> Eff es (IORef a)
- readIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> Eff es a
- readIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> Eff es a
- writeIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es ()
- writeIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es ()
- atomicWriteIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es ()
- atomicWriteIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es ()
- modifyIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es ()
- modifyIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es ()
- atomicModifyIORef :: forall (es :: [Effect]) a b. IORefE :> es => IORef a -> (a -> (a, b)) -> Eff es b
- atomicModifyIORef' :: forall (es :: [Effect]) a b. IORefE :> es => IORef a -> (a -> (a, b)) -> Eff es b
- runIORef :: forall (es :: [Effect]) a. IOE :> es => Eff (IORefE ': es) a -> Eff es a
- atomicModifyIORef_ :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es ()
- atomicModifyIORef'_ :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es ()
- data IORef a
Effect
data IORefE (a :: Type -> Type) b Source #
Static effect for IORef.
Since: 0.1
Instances
| type DispatchOf IORefE Source # | |
Defined in Effectful.IORef.Static | |
| data StaticRep IORefE Source # | |
Defined in Effectful.IORef.Static | |
newIORef :: forall (es :: [Effect]) a. IORefE :> es => a -> Eff es (IORef a) Source #
Lifted newIORef.
Since: 0.1
newIORef' :: forall (es :: [Effect]) a. IORefE :> es => a -> Eff es (IORef a) Source #
Evaluates a to WHNF then calls newIORef.
Since: 0.1
readIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> Eff es a Source #
Lifted readIORef.
Since: 0.1
readIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> Eff es a Source #
Evaluates the result of readIORef to WHNF.
Since: 0.1
writeIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es () Source #
Lifted writeIORef.
Since: 0.1
writeIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es () Source #
Evaluates a to WHNF before calling writeIORef.
Since: 0.1
atomicWriteIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es () Source #
Lifted atomicWriteIORef.
Since: 0.1
atomicWriteIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es () Source #
Lifted atomicWriteIORef'.
Since: 0.1
modifyIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es () Source #
Lifted modifyIORef.
Since: 0.1
modifyIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es () Source #
Lifted modifyIORef'.
Since: 0.1
atomicModifyIORef :: forall (es :: [Effect]) a b. IORefE :> es => IORef a -> (a -> (a, b)) -> Eff es b Source #
Lifted atomicModifyIORef.
Since: 0.1
atomicModifyIORef' :: forall (es :: [Effect]) a b. IORefE :> es => IORef a -> (a -> (a, b)) -> Eff es b Source #
Lifted atomicModifyIORef'.
Since: 0.1
Handlers
runIORef :: forall (es :: [Effect]) a. IOE :> es => Eff (IORefE ': es) a -> Eff es a Source #
Runs an IORefE effect.
Since: 0.1
Utils
atomicModifyIORef_ :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es () Source #
Variant of atomicModifyIORef which ignores the return value.
Since: 0.1
atomicModifyIORef'_ :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> (a -> a) -> Eff es () Source #
Variant of atomicModifyIORef' which ignores the return value.
Since: 0.1
Re-exports
A mutable variable in the IO monad.
>>>import GHC.Internal.Data.IORef>>>r <- newIORef 0>>>readIORef r0>>>writeIORef r 1>>>readIORef r1>>>atomicWriteIORef r 2>>>readIORef r2>>>modifyIORef' r (+ 1)>>>readIORef r3>>>atomicModifyIORef' r (\a -> (a + 1, ()))>>>readIORef r4