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

Control.Kernmantle.Rope.Internal

Synopsis

Documentation

type BinEff = * -> * -> * Source #

The kind for all binary effects. First param is usually an input (contravariant) of the effect and second one an output (covariant).

type UnaryEff = * -> * Source #

The kind for unary effects

type Strand = (Symbol, BinEff) Source #

The kind for a named binary effect. Must remain a tuple because that's what vinyl expects.

type family StrandName t where ... Source #

Equations

StrandName '(name, eff) = name 

type family StrandEff t where ... Source #

Equations

StrandEff '(name, eff) = eff 

type RopeRec = (Strand -> *) -> [Strand] -> * Source #

The kind for records that will contain Weavers. First type param will most often be Weaver someCore

newtype Weaver (interp :: BinEff) (strand :: Strand) Source #

Runs one strand (* -> * -> * effect) in a interp effect. Is parameterized over a Strand (and not just a BinEffect) even if it ignores its name internally because that's what is expect by the RopeRec

Constructors

Weaver 

Fields

mapWeaverInterp :: (interp :-> interp') -> Weaver interp strand -> Weaver interp' strand Source #

newtype RopeRunner (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff) (core :: BinEff) a b Source #

The internal implementation of a Rope, where interp and core can be two different types (this facilitates implementation of some functions).

record holds the functions to interpret the strands in an interp effect. And then all these interpreted effects will run in a core effect.

Constructors

RopeRunner (record (Weaver interp) mantle -> core a b) 

Instances

Instances details
TryEffect ex core => TryEffect ex (RopeRunner record mantle interp core) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

tryE :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core a (Either ex b) Source #

ThrowEffect ex core => ThrowEffect ex (RopeRunner record mantle interp core) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

throwE :: RopeRunner record mantle interp core (Either ex b) b Source #

SieveTrans f core => SieveTrans f (RopeRunner record mantle interp core) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

liftSieve :: (a -> f b) -> RopeRunner record mantle interp core a b Source #

mapSieve :: ((a -> f b) -> a' -> f b') -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp 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 #

BifunctorFunctor (RopeRunner record mantle interp :: BinEff -> Type -> Type -> Type) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

bifmap :: forall (p :: k -> k1 -> Type) (q :: k -> k1 -> Type). (p :-> q) -> RopeRunner record mantle interp p :-> RopeRunner record mantle interp q #

ProfunctorFunctor (RopeRunner record mantle interp :: BinEff -> Type -> Type -> Type) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

promap :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p => (p :-> q) -> RopeRunner record mantle interp p :-> RopeRunner record mantle interp q #

Category core => Category (RopeRunner record mantle interp core :: Type -> Type -> Type) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

id :: forall (a :: k). RopeRunner record mantle interp core a a #

(.) :: forall (b :: k) (c :: k) (a :: k). RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core a c #

RMap m => EffProfunctor (RopeRunner (Rec :: (Strand -> Type) -> [Strand] -> Type) m) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

effdimap :: forall (a' :: Type -> Type -> Type) (a :: Type -> Type -> Type) (b :: Type -> Type -> Type) (b' :: Type -> Type -> Type). (a' :-> a) -> (b :-> b') -> RopeRunner Rec m a b :-> RopeRunner Rec m a' b' Source #

efflmap :: forall (a' :: Type -> Type -> Type) (a :: Type -> Type -> Type) (b :: Type -> Type -> Type). (a' :-> a) -> RopeRunner Rec m a b :-> RopeRunner Rec m a' b Source #

ProfunctorMonad (RopeRunner record mantle interp) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

proreturn :: forall (p :: Type -> Type -> Type). Profunctor p => p :-> RopeRunner record mantle interp p #

projoin :: forall (p :: Type -> Type -> Type). Profunctor p => RopeRunner record mantle interp (RopeRunner record mantle interp p) :-> RopeRunner record mantle interp p #

EffPointedFunctor (RopeRunner record mantle interp) Source # 
Instance details

Defined in Control.Kernmantle.Rope.Internal

Methods

effpure :: forall (eff :: Type -> Type -> Type). eff :-> RopeRunner record mantle interp eff Source #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

bimap :: (a -> b) -> (c -> d) -> RopeRunner record mantle interp core a c -> RopeRunner record mantle interp core b d #

first :: (a -> b) -> RopeRunner record mantle interp core a c -> RopeRunner record mantle interp core b c #

second :: (b -> c) -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core a c #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

arr :: (b -> c) -> RopeRunner record mantle interp core b c #

first :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core (b, d) (c, d) #

second :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core (d, b) (d, c) #

(***) :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core b' c' -> RopeRunner record mantle interp core (b, b') (c, c') #

(&&&) :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core b c' -> RopeRunner record mantle interp core b (c, c') #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

zeroArrow :: RopeRunner record mantle interp core b c #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

(<+>) :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core b c #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

left :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core (Either b d) (Either c d) #

right :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core (Either d b) (Either d c) #

(+++) :: RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core b' c' -> RopeRunner record mantle interp core (Either b b') (Either c c') #

(|||) :: RopeRunner record mantle interp core b d -> RopeRunner record mantle interp core c d -> RopeRunner record mantle interp core (Either b c) d #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

loop :: RopeRunner record mantle interp core (b, d) (c, d) -> RopeRunner record mantle interp core b c #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

bipure :: a -> b -> RopeRunner record mantle interp core a b #

(<<*>>) :: RopeRunner record mantle interp core (a -> b) (c -> d) -> RopeRunner record mantle interp core a c -> RopeRunner record mantle interp core b d #

biliftA2 :: (a -> b -> c) -> (d -> e -> f) -> RopeRunner record mantle interp core a d -> RopeRunner record mantle interp core b e -> RopeRunner record mantle interp core c f #

(*>>) :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core c d -> RopeRunner record mantle interp core c d #

(<<*) :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core c d -> RopeRunner record mantle interp core a b #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

map' :: Functor f => RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (f a) (f b) #

roam :: ((a -> b) -> s -> t) -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core s t #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

traverse' :: Traversable f => RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (f a) (f b) #

wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core s t #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

left' :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (Either a c) (Either b c) #

right' :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (Either c a) (Either c b) #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

unleft :: RopeRunner record mantle interp core (Either a d) (Either b d) -> RopeRunner record mantle interp core a b #

unright :: RopeRunner record mantle interp core (Either d a) (Either d b) -> RopeRunner record mantle interp core a b #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

closed :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (x -> a) (x -> b) #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

first' :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (a, c) (b, c) #

second' :: RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core (c, a) (c, b) #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

unfirst :: RopeRunner record mantle interp core (a, d) (b, d) -> RopeRunner record mantle interp core a b #

unsecond :: RopeRunner record mantle interp core (d, a) (d, b) -> RopeRunner record mantle interp core a b #

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

Defined in Control.Kernmantle.Rope.Internal

Methods

dimap :: (a -> b) -> (c -> d) -> RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core a d #

lmap :: (a -> b) -> RopeRunner record mantle interp core b c -> RopeRunner record mantle interp core a c #

rmap :: (b -> c) -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core a c #

(#.) :: forall a b c q. Coercible c b => q b c -> RopeRunner record mantle interp core a b -> RopeRunner record mantle interp core a c #

(.#) :: forall a b c q. Coercible b a => RopeRunner record mantle interp core b c -> q a b -> RopeRunner record mantle interp core a c #

splitRopeRunner :: RopeRunner Rec (mantle1 ++ mantle2) interp core :-> RopeRunner Rec mantle1 interp (RopeRunner Rec mantle2 interp core) Source #

Splits a RopeRunner in two parts, so we can select several strands to act on

type RetwinableAs record strands core strands' = (RecSubset record strands strands' (RImage strands strands'), RecSubsetFCtx record (Weaver core)) Source #

Indicates that strands can be reordered and considered a subset of strands'

joinRopeRunner :: (RetwinableAs r mantle1 interp mantle, RetwinableAs r mantle2 interp mantle) => RopeRunner r mantle1 interp (RopeRunner r mantle2 interp core) :-> RopeRunner r mantle interp core Source #

type family MapStrandEffs f mantle where ... Source #

Wrap each strand effect inside a type constructor

Equations

MapStrandEffs f '[] = '[] 
MapStrandEffs f (s ': strands) = '(StrandName s, f (StrandEff s)) ': MapStrandEffs f strands 

effmapRopeRec :: EffFunctor f => Rec (Weaver interp) strands -> Rec (Weaver (f interp)) (MapStrandEffs f strands) Source #

unwrapRopeRunner :: EffFunctor f => RopeRunner Rec (MapStrandEffs f strands) (f core) core :-> RopeRunner Rec strands core core Source #

When all the strands of a Rope are built by the same EffFunctor, we can run them. See splitRope to isolate some strands in a Rope

unwrapSomeStrands Source #

Arguments

:: (EffFunctor f, RMap (MapStrandEffs f mantle1)) 
=> (f core' :-> interp)

How to run the extracted EffFunctor layer

-> (RopeRunner Rec mantle2 interp core :-> core')

What to do with the remaining strands (those not wrapped)

-> RopeRunner Rec (MapStrandEffs f mantle1 ++ mantle2) interp core :-> RopeRunner Rec mantle1 core' core'

The resulting RopeRunner, where