Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type BinEff = * -> * -> *
- type UnaryEff = * -> *
- type Strand = (Symbol, BinEff)
- type family StrandName t where ...
- type family StrandEff t where ...
- type RopeRec = (Strand -> *) -> [Strand] -> *
- newtype Weaver (interp :: BinEff) (strand :: Strand) = Weaver {
- weaveStrand :: StrandEff strand :-> interp
- mapWeaverInterp :: (interp :-> interp') -> Weaver interp strand -> Weaver interp' strand
- newtype RopeRunner (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff) (core :: BinEff) a b = RopeRunner (record (Weaver interp) mantle -> core a b)
- splitRopeRunner :: RopeRunner Rec (mantle1 ++ mantle2) interp core :-> RopeRunner Rec mantle1 interp (RopeRunner Rec mantle2 interp core)
- type RetwinableAs record strands core strands' = (RecSubset record strands strands' (RImage strands strands'), RecSubsetFCtx record (Weaver core))
- 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
- type family MapStrandEffs f mantle where ...
- effmapRopeRec :: EffFunctor f => Rec (Weaver interp) strands -> Rec (Weaver (f interp)) (MapStrandEffs f strands)
- unwrapRopeRunner :: EffFunctor f => RopeRunner Rec (MapStrandEffs f strands) (f core) core :-> RopeRunner Rec strands core core
- unwrapSomeStrands :: (EffFunctor f, RMap (MapStrandEffs f mantle1)) => (f core' :-> interp) -> (RopeRunner Rec mantle2 interp core :-> core') -> RopeRunner Rec (MapStrandEffs f mantle1 ++ mantle2) interp core :-> RopeRunner Rec mantle1 core' core'
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 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 #
StrandName '(name, eff) = name |
type RopeRec = (Strand -> *) -> [Strand] -> * Source #
The kind for records that will contain Weaver
s. 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
Weaver | |
|
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.
RopeRunner (record (Weaver interp) mantle -> core a b) |
Instances
TryEffect ex core => TryEffect ex (RopeRunner record mantle interp core) Source # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal throwE :: RopeRunner record mantle interp core (Either ex b) b Source # | |
SieveTrans f core => SieveTrans f (RopeRunner record mantle interp core) Source # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal liftAutoIdent :: (ArrowIdent -> eff a b) -> RopeRunner record mantle interp core a b Source # | |
BifunctorFunctor (RopeRunner record mantle interp :: BinEff -> Type -> Type -> Type) Source # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal | |
Bifunctor core => Bifunctor (RopeRunner record mantle interp core) Source # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal zeroArrow :: RopeRunner record mantle interp core b c # | |
ArrowPlus core => ArrowPlus (RopeRunner record mantle interp core) Source # | |
Defined in Control.Kernmantle.Rope.Internal (<+>) :: 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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 # | |
Defined in Control.Kernmantle.Rope.Internal 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
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
:: (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 |