| Copyright | (c) 2024 Sayo contributors |
|---|---|
| License | MPL-2.0 (see the LICENSE file) |
| Maintainer | ymdfield@outlook.jp |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Control.Monad.Hefty.Concurrent.Stream
Description
Coroutine-based, composable, and resumable concurrent streams.
Synopsis
- data Machinery es ans i o where
- newtype Machine f ans i o = Machine {
- runMachine :: f (MachineStatus f ans i o)
- data MachineStatus f ans i o
- = Terminated ans
- | Waiting (i -> Machine f ans i o)
- | Produced o (Machine f ans i o)
- data MachineryViewL es ans i o where
- newtype MachineryIO es ans i o = MachineryIO {
- unMachineryIO :: Machinery es ans i o
- machine :: WeakenHOEs es => Eff (Input i ': (Output o ': RemoveHOEs es)) ans -> Machine (Eff es) ans i o
- buffering :: forall b c d ans es. Eff (Input b ': (Output c ': es)) ans -> Eff (State (Either (Seq c) d) ': (Input (b, d) ': (Output (c, d) ': es))) ans
- leftMachinery :: forall b c d ans es. Machinery es ans b c -> Machinery es ans (Either b d) (Either c d)
- runMachinery :: forall i o ans es. (Parallel :> es, Semigroup ans, WeakenHOEs es) => Machinery (RemoveHOEs es) ans i o -> Eff es (MachineStatus (Eff es) ans i o)
- runMachineryL :: forall i o ans es. (Parallel :> es, Semigroup ans, WeakenHOEs es) => MachineryViewL (RemoveHOEs es) ans i o -> Eff es (MachineStatus (Eff es) ans i o)
- mviewl :: Machinery es ans i o -> MachineryViewL es ans i o
- runMachineryIO :: forall i o ans es. (UnliftIO :> es, Emb IO :> es) => Eff es i -> (o -> Eff es ()) -> Machinery es ans i o -> Eff es ans
- runMachineryIOL :: forall i o ans es. (UnliftIO :> es, Emb IO :> es) => Eff es i -> (o -> Eff es ()) -> MachineryViewL es ans i o -> Eff es ans
- runMachineryIO_ :: forall ans es. (UnliftIO :> es, Emb IO :> es) => Machinery es ans () () -> Eff es ans
- module Control.Monad.Hefty.Input
- module Control.Monad.Hefty.Output
Documentation
data Machinery es ans i o where Source #
Constructors
| Unit :: forall i o ans es. Eff (Input i ': (Output o ': es)) ans -> Machinery es ans i o | |
| Connect :: forall a b c ans es. Machinery es ans a b -> Machinery es ans b c -> Machinery es ans a c |
Instances
| Category (Machinery es ans :: Type -> Type -> Type) Source # | |
| FOEs es => Arrow (Machinery es ans) Source # | |
Defined in Control.Monad.Hefty.Concurrent.Stream Methods arr :: (b -> c) -> Machinery es ans b c # first :: Machinery es ans b c -> Machinery es ans (b, d) (c, d) # second :: Machinery es ans b c -> Machinery es ans (d, b) (d, c) # (***) :: Machinery es ans b c -> Machinery es ans b' c' -> Machinery es ans (b, b') (c, c') # (&&&) :: Machinery es ans b c -> Machinery es ans b c' -> Machinery es ans b (c, c') # | |
| FOEs es => ArrowChoice (Machinery es ans) Source # | |
Defined in Control.Monad.Hefty.Concurrent.Stream Methods left :: Machinery es ans b c -> Machinery es ans (Either b d) (Either c d) # right :: Machinery es ans b c -> Machinery es ans (Either d b) (Either d c) # (+++) :: Machinery es ans b c -> Machinery es ans b' c' -> Machinery es ans (Either b b') (Either c c') # (|||) :: Machinery es ans b d -> Machinery es ans c d -> Machinery es ans (Either b c) d # | |
newtype Machine f ans i o Source #
Constructors
| Machine | |
Fields
| |
data MachineStatus f ans i o Source #
Constructors
| Terminated ans | |
| Waiting (i -> Machine f ans i o) | |
| Produced o (Machine f ans i o) |
data MachineryViewL es ans i o where Source #
Left view deconstruction data structure for Machinery Pipeline.
This allows the number of generated threads to be reduced to the number of machine units.
newtype MachineryIO es ans i o Source #
Constructors
| MachineryIO | |
Fields
| |
Instances
| Category (MachineryIO es ans :: Type -> Type -> Type) Source # | |
Defined in Control.Monad.Hefty.Concurrent.Stream Methods id :: forall (a :: k). MachineryIO es ans a a # (.) :: forall (b :: k) (c :: k) (a :: k). MachineryIO es ans b c -> MachineryIO es ans a b -> MachineryIO es ans a c # | |
| Emb IO :> es => Arrow (MachineryIO es ans) Source # | |
Defined in Control.Monad.Hefty.Concurrent.Stream Methods arr :: (b -> c) -> MachineryIO es ans b c # first :: MachineryIO es ans b c -> MachineryIO es ans (b, d) (c, d) # second :: MachineryIO es ans b c -> MachineryIO es ans (d, b) (d, c) # (***) :: MachineryIO es ans b c -> MachineryIO es ans b' c' -> MachineryIO es ans (b, b') (c, c') # (&&&) :: MachineryIO es ans b c -> MachineryIO es ans b c' -> MachineryIO es ans b (c, c') # | |
| Emb IO :> es => ArrowChoice (MachineryIO es ans) Source # | |
Defined in Control.Monad.Hefty.Concurrent.Stream Methods left :: MachineryIO es ans b c -> MachineryIO es ans (Either b d) (Either c d) # right :: MachineryIO es ans b c -> MachineryIO es ans (Either d b) (Either d c) # (+++) :: MachineryIO es ans b c -> MachineryIO es ans b' c' -> MachineryIO es ans (Either b b') (Either c c') # (|||) :: MachineryIO es ans b d -> MachineryIO es ans c d -> MachineryIO es ans (Either b c) d # | |
machine :: WeakenHOEs es => Eff (Input i ': (Output o ': RemoveHOEs es)) ans -> Machine (Eff es) ans i o Source #
buffering :: forall b c d ans es. Eff (Input b ': (Output c ': es)) ans -> Eff (State (Either (Seq c) d) ': (Input (b, d) ': (Output (c, d) ': es))) ans Source #
leftMachinery :: forall b c d ans es. Machinery es ans b c -> Machinery es ans (Either b d) (Either c d) Source #
runMachinery :: forall i o ans es. (Parallel :> es, Semigroup ans, WeakenHOEs es) => Machinery (RemoveHOEs es) ans i o -> Eff es (MachineStatus (Eff es) ans i o) Source #
runMachineryL :: forall i o ans es. (Parallel :> es, Semigroup ans, WeakenHOEs es) => MachineryViewL (RemoveHOEs es) ans i o -> Eff es (MachineStatus (Eff es) ans i o) Source #
mviewl :: Machinery es ans i o -> MachineryViewL es ans i o Source #
Left view deconstruction for Machinery Pipeline. [average O(1)]
runMachineryIO :: forall i o ans es. (UnliftIO :> es, Emb IO :> es) => Eff es i -> (o -> Eff es ()) -> Machinery es ans i o -> Eff es ans Source #
runMachineryIOL :: forall i o ans es. (UnliftIO :> es, Emb IO :> es) => Eff es i -> (o -> Eff es ()) -> MachineryViewL es ans i o -> Eff es ans Source #
runMachineryIO_ :: forall ans es. (UnliftIO :> es, Emb IO :> es) => Machinery es ans () () -> Eff es ans Source #
module Control.Monad.Hefty.Input
module Control.Monad.Hefty.Output