Safe Haskell | None |
---|---|
Language | Haskell2010 |
Helper functions for Arrow effects
Synopsis
- parMapA :: ArrowChoice a => a b c -> a [b] [c]
- seqMapA :: ArrowChoice a => a b c -> a [b] [c]
- foldlA :: ArrowChoice a => a (b, acc) acc -> a ([b], acc) acc
- filterA :: ArrowChoice a => a b Bool -> a [b] [b]
- catchE :: (TryEffect ex eff, ArrowChoice eff) => eff e c -> eff (e, ex) c -> eff e c
- newtype SplitId = SplitId (Ratio Word)
- split :: (s -> SplitId) -> (s -> SplitId -> s) -> (s -> a) -> (a -> b -> c) -> (s -> b) -> s -> c
- data ArrowIdent = ArrowIdent {}
- newtype AutoIdent arr a b = AutoIdent (ArrowIdent -> arr a b)
- runAutoIdent' :: SplitId -> AutoIdent arr a b -> arr a b
- runAutoIdent :: AutoIdent arr a b -> arr a b
- class HasAutoIdent wrappedEff eff | eff -> wrappedEff where
- liftAutoIdent :: (ArrowIdent -> wrappedEff a b) -> eff a b
Documentation
parMapA :: ArrowChoice a => a b c -> a [b] [c] Source #
Map an arrow over a list using (***)
seqMapA :: ArrowChoice a => a b c -> a [b] [c] Source #
Map an arrow over a list using (>>>) and first
foldlA :: ArrowChoice a => a (b, acc) acc -> a ([b], acc) acc Source #
Repeats an arrow step in order to fold a list
filterA :: ArrowChoice a => a b Bool -> a [b] [b] Source #
Filter a list given an arrow filter
:: (TryEffect ex eff, ArrowChoice eff) | |
=> eff e c | The effect to wrap |
-> eff (e, ex) c | What to do in case of exception |
-> eff e c |
If a TryEffect
is also an ArrowChoice
, then we can implement catch
A SplitId is a ratio of two positive numbers
split :: (s -> SplitId) -> (s -> SplitId -> s) -> (s -> a) -> (a -> b -> c) -> (s -> b) -> s -> c Source #
split
defines the Calkin-Wilf tree. Its guaranteed never to produce twice
the same result if we split repeatedly starting from 1.
data ArrowIdent Source #
The identifiers reflect the structure of the pipeline that led to some
task. They are split
at every use of (.), (***), (|||) or (+). This makes
it so every task in the pipeline has a different identifier.
Instances
newtype AutoIdent arr a b Source #
An arrow transformer that can automatically determine an identifier from
its position in a pipeline. It is isomorphic to a Reader ArrowIdent ~> arr
, but
we need a different Arrow instance than what Cayley
provides.
AutoIdent (ArrowIdent -> arr a b) |
Instances
runAutoIdent' :: SplitId -> AutoIdent arr a b -> arr a b Source #
runAutoIdent :: AutoIdent arr a b -> arr a b Source #
class HasAutoIdent wrappedEff eff | eff -> wrappedEff where Source #
All effects that internally feature some AutoIdent
liftAutoIdent :: (ArrowIdent -> wrappedEff a b) -> eff a b Source #
Instances
HasAutoIdent eff (AutoIdent eff) Source # | |
Defined in Control.Kernmantle.Arrow liftAutoIdent :: (ArrowIdent -> eff a b) -> AutoIdent eff a b Source # | |
HasAutoIdent eff core => HasAutoIdent eff (Rope record mantle core) Source # | |
Defined in Control.Kernmantle.Rope liftAutoIdent :: (ArrowIdent -> eff a b) -> Rope record mantle core a b Source # | |
HasAutoIdent eff core => HasAutoIdent eff (RopeRunner record mantle interp core) Source # | |
Defined in Control.Kernmantle.Rope.Internal liftAutoIdent :: (ArrowIdent -> eff a b) -> RopeRunner record mantle interp core a b Source # | |
(HasAutoIdent ai eff, Applicative f) => HasAutoIdent ai (Cayley f eff) Source # | |
Defined in Control.Kernmantle.Arrow liftAutoIdent :: (ArrowIdent -> ai a b) -> Cayley f eff a b Source # |