Safe Haskell | None |
---|---|
Language | Haskell2010 |
Effectful.Labeled.Writer
Synopsis
- data Writer w (a :: Type -> Type) b where
- runWriterLocal :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es (a, w)
- execWriterLocal :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es w
- runWriterShared :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es (a, w)
- execWriterShared :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es w
- tell :: forall {k} (label :: k) w (es :: [Effect]). (HasCallStack, Labeled label (Writer w) :> es) => w -> Eff es ()
- listen :: forall {k} (label :: k) w (es :: [Effect]) a. (HasCallStack, Labeled label (Writer w) :> es) => Eff es a -> Eff es (a, w)
- listens :: forall {k} (label :: k) w (es :: [Effect]) a b. (HasCallStack, Labeled label (Writer w) :> es) => (w -> b) -> Eff es a -> Eff es (a, b)
Effect
data Writer w (a :: Type -> Type) b where Source #
Provide access to a write only value of type w
.
Constructors
Tell :: forall w (a :: Type -> Type). w -> Writer w a () | |
Listen :: forall (a :: Type -> Type) a1 w. a a1 -> Writer w a (a1, w) |
Instances
type DispatchOf (Writer w) Source # | |
Defined in Effectful.Writer.Dynamic |
Handlers
Local
runWriterLocal :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es (a, w) Source #
Run the Writer
effect and return the final value along with the final
output (via Effectful.Writer.Static.Local).
execWriterLocal :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es w Source #
Run a Writer
effect and return the final output, discarding the final
value (via Effectful.Writer.Static.Local).
Shared
runWriterShared :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es (a, w) Source #
Run the Writer
effect and return the final value along with the final
output (via Effectful.Writer.Static.Shared).
execWriterShared :: forall {k} (label :: k) w (es :: [(Type -> Type) -> Type -> Type]) a. (HasCallStack, Monoid w) => Eff (Labeled label (Writer w) ': es) a -> Eff es w Source #
Run the Writer
effect and return the final output, discarding the final
value (via Effectful.Writer.Static.Shared).
Operations
tell :: forall {k} (label :: k) w (es :: [Effect]). (HasCallStack, Labeled label (Writer w) :> es) => w -> Eff es () Source #
Append the given output to the overall output of the Writer
.
listen :: forall {k} (label :: k) w (es :: [Effect]) a. (HasCallStack, Labeled label (Writer w) :> es) => Eff es a -> Eff es (a, w) Source #
Execute an action and append its output to the overall output of the
Writer
.