{-# LANGUAGE AllowAmbiguousTypes #-}
module Effectful.Labeled.Output
(
Output(..)
, runOutputAction
, runOutputLocalArray
, runOutputLocalList
, runOutputSharedArray
, runOutputSharedList
, output
, Labeled(..)
, Array
) where
import Data.Primitive.Array
import Effectful
import Effectful.Dispatch.Dynamic
import Effectful.Labeled
import Effectful.Output.Dynamic (Output(..))
import Effectful.Output.Dynamic qualified as O
runOutputAction
:: forall label o es a
. HasCallStack
=> (HasCallStack => o -> Eff es ())
-> Eff (Labeled label (Output o) : es) a
-> Eff es a
runOutputAction :: forall {k} (label :: k) o (es :: [Effect]) a.
HasCallStack =>
(HasCallStack => o -> Eff es ())
-> Eff (Labeled label (Output o) : es) a -> Eff es a
runOutputAction = forall (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
forall {k} (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
runLabeled @label ((Eff (Output o : es) a -> Eff es a)
-> Eff (Labeled label (Output o) : es) a -> Eff es a)
-> ((o -> Eff es ()) -> Eff (Output o : es) a -> Eff es a)
-> (o -> Eff es ())
-> Eff (Labeled label (Output o) : es) a
-> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (o -> Eff es ()) -> Eff (Output o : es) a -> Eff es a
(HasCallStack => o -> Eff es ())
-> Eff (Output o : es) a -> Eff es a
forall o (es :: [Effect]) a.
HasCallStack =>
(HasCallStack => o -> Eff es ())
-> Eff (Output o : es) a -> Eff es a
O.runOutputAction
runOutputLocalArray
:: forall label o es a
. HasCallStack
=> Eff (Labeled label (Output o) : es) a
-> Eff es (a, Array o)
runOutputLocalArray :: forall {k} (label :: k) o (es :: [Effect]) a.
HasCallStack =>
Eff (Labeled label (Output o) : es) a -> Eff es (a, Array o)
runOutputLocalArray = forall (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
forall {k} (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
runLabeled @label Eff (Output o : es) a -> Eff es (a, Array o)
forall o (es :: [Effect]) a.
HasCallStack =>
Eff (Output o : es) a -> Eff es (a, Array o)
O.runOutputLocalArray
runOutputLocalList
:: forall label o es a
. HasCallStack
=> Eff (Labeled label (Output o) : es) a
-> Eff es (a, [o])
runOutputLocalList :: forall {k} (label :: k) o (es :: [Effect]) a.
HasCallStack =>
Eff (Labeled label (Output o) : es) a -> Eff es (a, [o])
runOutputLocalList = forall (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
forall {k} (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
runLabeled @label Eff (Output o : es) a -> Eff es (a, [o])
forall o (es :: [Effect]) a.
HasCallStack =>
Eff (Output o : es) a -> Eff es (a, [o])
O.runOutputLocalList
runOutputSharedArray
:: forall label o es a
. HasCallStack
=> Eff (Labeled label (Output o) : es) a
-> Eff es (a, Array o)
runOutputSharedArray :: forall {k} (label :: k) o (es :: [Effect]) a.
HasCallStack =>
Eff (Labeled label (Output o) : es) a -> Eff es (a, Array o)
runOutputSharedArray = forall (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
forall {k} (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
runLabeled @label Eff (Output o : es) a -> Eff es (a, Array o)
forall o (es :: [Effect]) a.
HasCallStack =>
Eff (Output o : es) a -> Eff es (a, Array o)
O.runOutputSharedArray
runOutputSharedList
:: forall label o es a
. HasCallStack
=> Eff (Labeled label (Output o) : es) a
-> Eff es (a, [o])
runOutputSharedList :: forall {k} (label :: k) o (es :: [Effect]) a.
HasCallStack =>
Eff (Labeled label (Output o) : es) a -> Eff es (a, [o])
runOutputSharedList = forall (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
forall {k} (label :: k) (e :: Effect) (es :: [Effect]) a b.
HasCallStack =>
(Eff (e : es) a -> Eff es b)
-> Eff (Labeled label e : es) a -> Eff es b
runLabeled @label Eff (Output o : es) a -> Eff es (a, [o])
forall o (es :: [Effect]) a.
HasCallStack =>
Eff (Output o : es) a -> Eff es (a, [o])
O.runOutputSharedList
output
:: forall label o es
. (HasCallStack, Labeled label (Output o) :> es)
=> o
-> Eff es ()
output :: forall {k} (label :: k) o (es :: [Effect]).
(HasCallStack, Labeled label (Output o) :> es) =>
o -> Eff es ()
output = Labeled label (Output o) (Eff es) () -> Eff es ()
forall (e :: Effect) (es :: [Effect]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (Labeled label (Output o) (Eff es) () -> Eff es ())
-> (o -> Labeled label (Output o) (Eff es) ()) -> o -> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (label :: k) (e :: Effect) (a :: Type -> Type) b.
e a b -> Labeled label e a b
forall {k} (label :: k) (e :: Effect) (a :: Type -> Type) b.
e a b -> Labeled label e a b
Labeled @label (Output o (Eff es) () -> Labeled label (Output o) (Eff es) ())
-> (o -> Output o (Eff es) ())
-> o
-> Labeled label (Output o) (Eff es) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. o -> Output o (Eff es) ()
forall o (a :: Type -> Type). o -> Output o a ()
Output