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
- writeIORef :: forall (es :: [Effect]) a. IORefE :> es => IORef a -> a -> Eff es ()
- writeIORef' :: forall (es :: [Effect]) a. IORefE :> es => IORef 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
- 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 ()
- 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
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
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
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
Re-exports
A mutable variable in the IO
monad.
>>>
import GHC.Internal.Data.IORef
>>>
r <- newIORef 0
>>>
readIORef r
0>>>
writeIORef r 1
>>>
readIORef r
1>>>
atomicWriteIORef r 2
>>>
readIORef r
2>>>
modifyIORef' r (+ 1)
>>>
readIORef r
3>>>
atomicModifyIORef' r (\a -> (a + 1, ()))
>>>
readIORef r
4
Instances
NFData1 IORef | Since: deepseq-1.4.3.0 |
Defined in Control.DeepSeq | |
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: deepseq-1.4.2.0 |
Defined in Control.DeepSeq | |
Eq (IORef a) | Pointer equality. @since base-4.0.0.0 |