kernmantle-0.1.0.0: Composing Applicatives, Monads, Comonads and Arrows into Arrows
Safe HaskellNone
LanguageHaskell2010

Control.Kernmantle.Arrow

Description

Helper functions for Arrow effects

Synopsis

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

catchE Source #

Arguments

:: (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

newtype SplitId Source #

A SplitId is a ratio of two positive numbers

Constructors

SplitId (Ratio Word) 

Instances

Instances details
Eq SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

(==) :: SplitId -> SplitId -> Bool #

(/=) :: SplitId -> SplitId -> Bool #

Num SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Ord SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Show SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Generic SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Associated Types

type Rep SplitId :: Type -> Type #

Methods

from :: SplitId -> Rep SplitId x #

to :: Rep SplitId x -> SplitId #

type Rep SplitId Source # 
Instance details

Defined in Control.Kernmantle.Arrow

type Rep SplitId = D1 ('MetaData "SplitId" "Control.Kernmantle.Arrow" "kernmantle-0.1.0.0-JWRumlUPJuw56cVSeluRKt" 'True) (C1 ('MetaCons "SplitId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Ratio Word))))

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.

Constructors

ArrowIdent 

Instances

Instances details
Eq ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Ord ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Show ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Generic ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Associated Types

type Rep ArrowIdent :: Type -> Type #

type Rep ArrowIdent Source # 
Instance details

Defined in Control.Kernmantle.Arrow

type Rep ArrowIdent = D1 ('MetaData "ArrowIdent" "Control.Kernmantle.Arrow" "kernmantle-0.1.0.0-JWRumlUPJuw56cVSeluRKt" 'False) (C1 ('MetaCons "ArrowIdent" 'PrefixI 'True) ((S1 ('MetaSel ('Just "aidChoice") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 SplitId) :*: S1 ('MetaSel ('Just "aidPlus") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 SplitId)) :*: (S1 ('MetaSel ('Just "aidPar") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 SplitId) :*: S1 ('MetaSel ('Just "aidComp") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 SplitId))))

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.

Constructors

AutoIdent (ArrowIdent -> arr a b) 

Instances

Instances details
SieveTrans f eff => SieveTrans f (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftSieve :: (a -> f b) -> AutoIdent eff a b Source #

mapSieve :: ((a -> f b) -> a' -> f b') -> AutoIdent eff a b -> AutoIdent eff a' b' Source #

HasAutoIdent eff (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftAutoIdent :: (ArrowIdent -> eff a b) -> AutoIdent eff a b Source #

Arrow eff => Arrow (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

arr :: (b -> c) -> AutoIdent eff b c #

first :: AutoIdent eff b c -> AutoIdent eff (b, d) (c, d) #

second :: AutoIdent eff b c -> AutoIdent eff (d, b) (d, c) #

(***) :: AutoIdent eff b c -> AutoIdent eff b' c' -> AutoIdent eff (b, b') (c, c') #

(&&&) :: AutoIdent eff b c -> AutoIdent eff b c' -> AutoIdent eff b (c, c') #

ArrowZero arr => ArrowZero (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

zeroArrow :: AutoIdent arr b c #

ArrowPlus eff => ArrowPlus (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

(<+>) :: AutoIdent eff b c -> AutoIdent eff b c -> AutoIdent eff b c #

ArrowChoice eff => ArrowChoice (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

left :: AutoIdent eff b c -> AutoIdent eff (Either b d) (Either c d) #

right :: AutoIdent eff b c -> AutoIdent eff (Either d b) (Either d c) #

(+++) :: AutoIdent eff b c -> AutoIdent eff b' c' -> AutoIdent eff (Either b b') (Either c c') #

(|||) :: AutoIdent eff b d -> AutoIdent eff c d -> AutoIdent eff (Either b c) d #

ArrowLoop arr => ArrowLoop (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

loop :: AutoIdent arr (b, d) (c, d) -> AutoIdent arr b c #

Mapping arr => Mapping (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

map' :: Functor f => AutoIdent arr a b -> AutoIdent arr (f a) (f b) #

roam :: ((a -> b) -> s -> t) -> AutoIdent arr a b -> AutoIdent arr s t #

Traversing arr => Traversing (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

traverse' :: Traversable f => AutoIdent arr a b -> AutoIdent arr (f a) (f b) #

wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> AutoIdent arr a b -> AutoIdent arr s t #

Choice arr => Choice (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

left' :: AutoIdent arr a b -> AutoIdent arr (Either a c) (Either b c) #

right' :: AutoIdent arr a b -> AutoIdent arr (Either c a) (Either c b) #

Cochoice arr => Cochoice (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

unleft :: AutoIdent arr (Either a d) (Either b d) -> AutoIdent arr a b #

unright :: AutoIdent arr (Either d a) (Either d b) -> AutoIdent arr a b #

Closed arr => Closed (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

closed :: AutoIdent arr a b -> AutoIdent arr (x -> a) (x -> b) #

Strong arr => Strong (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

first' :: AutoIdent arr a b -> AutoIdent arr (a, c) (b, c) #

second' :: AutoIdent arr a b -> AutoIdent arr (c, a) (c, b) #

Costrong arr => Costrong (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

unfirst :: AutoIdent arr (a, d) (b, d) -> AutoIdent arr a b #

unsecond :: AutoIdent arr (d, a) (d, b) -> AutoIdent arr a b #

Profunctor arr => Profunctor (AutoIdent arr) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

dimap :: (a -> b) -> (c -> d) -> AutoIdent arr b c -> AutoIdent arr a d #

lmap :: (a -> b) -> AutoIdent arr b c -> AutoIdent arr a c #

rmap :: (b -> c) -> AutoIdent arr a b -> AutoIdent arr a c #

(#.) :: forall a b c q. Coercible c b => q b c -> AutoIdent arr a b -> AutoIdent arr a c #

(.#) :: forall a b c q. Coercible b a => AutoIdent arr b c -> q a b -> AutoIdent arr a c #

Category eff => Category (AutoIdent eff :: Type -> Type -> Type) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

id :: forall (a :: k). AutoIdent eff a a #

(.) :: forall (b :: k) (c :: k) (a :: k). AutoIdent eff b c -> AutoIdent eff a b -> AutoIdent eff a c #

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

Methods

liftAutoIdent :: (ArrowIdent -> wrappedEff a b) -> eff a b Source #

Instances

Instances details
HasAutoIdent eff (AutoIdent eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftAutoIdent :: (ArrowIdent -> eff a b) -> AutoIdent eff a b Source #

HasAutoIdent eff core => HasAutoIdent eff (Rope record mantle core) Source # 
Instance details

Defined in Control.Kernmantle.Rope

Methods

liftAutoIdent :: (ArrowIdent -> eff a b) -> Rope record mantle core a b Source #

HasAutoIdent eff core => HasAutoIdent eff (RopeRunner record mantle interp core) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

liftAutoIdent :: (ArrowIdent -> eff a b) -> RopeRunner record mantle interp core a b Source #

(HasAutoIdent ai eff, Applicative f) => HasAutoIdent ai (Cayley f eff) Source # 
Instance details

Defined in Control.Kernmantle.Arrow

Methods

liftAutoIdent :: (ArrowIdent -> ai a b) -> Cayley f eff a b Source #