{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}

module Control.Kernmantle.Rope.Internal where

import Control.Category
import Control.Arrow
import Control.Monad.Trans.Reader
import Data.Profunctor hiding (rmap)
import Data.Bifunctor
import Data.Biapplicative
import Data.Bifunctor.Tannen
import Data.Functor.Identity
import Data.Profunctor.Cayley
import Data.Profunctor.EffFunctor
import Data.Profunctor.Monad
import Data.Profunctor.Traversing
import Data.Profunctor.Trans
import Data.Vinyl hiding ((<+>))
import Data.Vinyl.TypeLevel
import GHC.TypeLits

import Prelude hiding (id, (.))

import Control.Kernmantle.Arrow
import Control.Kernmantle.Error


-- | The kind for all binary effects. First param is usually an input
-- (contravariant) of the effect and second one an output (covariant).
type BinEff = * -> * -> *

-- | The kind for unary effects
type UnaryEff = * -> *

-- | The kind for a named binary effect. Must remain a tuple because that's what
-- vinyl expects.
type Strand = (Symbol, BinEff)

type family StrandName t where
  StrandName '(name, eff) = name

type family StrandEff t where
  StrandEff '(name, eff) = eff

-- | The kind for records that will contain 'Weaver's. First type param will
-- most often be @Weaver someCore@
type RopeRec = (Strand -> *) -> [Strand] -> *

-- | 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'
newtype Weaver (interp::BinEff) (strand::Strand) = Weaver
  { Weaver interp strand
-> forall a b. StrandEff strand a b -> interp a b
weaveStrand :: StrandEff strand :-> interp }

mapWeaverInterp :: (interp :-> interp')
                -> Weaver interp strand
                -> Weaver interp' strand
mapWeaverInterp :: (interp :-> interp')
-> Weaver interp strand -> Weaver interp' strand
mapWeaverInterp interp :-> interp'
f (Weaver StrandEff strand :-> interp
w) = (StrandEff strand :-> interp') -> Weaver interp' strand
forall (interp :: BinEff) (strand :: Strand).
(StrandEff strand :-> interp) -> Weaver interp strand
Weaver ((StrandEff strand :-> interp') -> Weaver interp' strand)
-> (StrandEff strand :-> interp') -> Weaver interp' strand
forall a b. (a -> b) -> a -> b
$ interp a b -> interp' a b
interp :-> interp'
f (interp a b -> interp' a b)
-> (StrandEff strand a b -> interp a b)
-> StrandEff strand a b
-> interp' a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. StrandEff strand a b -> interp a b
StrandEff strand :-> interp
w
{-# INLINE mapWeaverInterp #-}

-- | 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.
newtype RopeRunner (record::RopeRec) (mantle::[Strand]) (interp::BinEff) (core::BinEff) a b =
  RopeRunner (record (Weaver interp) mantle -> core a b)
  
  deriving ( RopeRunner record mantle interp core a a
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
(forall a. RopeRunner record mantle interp core a a)
-> (forall b c a.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core a c)
-> Category (RopeRunner record mantle interp core)
forall a. RopeRunner record mantle interp core a a
forall b c a.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall k (cat :: k -> k -> *).
(forall (a :: k). cat a a)
-> (forall (b :: k) (c :: k) (a :: k).
    cat b c -> cat a b -> cat a c)
-> Category cat
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a.
Category core =>
RopeRunner record mantle interp core a a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Category core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
. :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
$c. :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Category core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
id :: RopeRunner record mantle interp core a a
$cid :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a.
Category core =>
RopeRunner record mantle interp core a a
Category
           , Category (RopeRunner record mantle interp core)
Category (RopeRunner record mantle interp core)
-> (forall b c.
    (b -> c) -> RopeRunner record mantle interp core b c)
-> (forall b c d.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core (b, d) (c, d))
-> (forall b c d.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core (d, b) (d, c))
-> (forall b c b' c'.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core b' c'
    -> RopeRunner record mantle interp core (b, b') (c, c'))
-> (forall 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'))
-> Arrow (RopeRunner record mantle interp core)
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (b, d) (c, d)
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')
(b -> c) -> RopeRunner record mantle interp core b c
forall b c. (b -> c) -> RopeRunner record mantle interp core b c
forall b c d.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (b, d) (c, d)
forall b c d.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (d, b) (d, c)
forall 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')
forall b c b' c'.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b' c'
-> RopeRunner record mantle interp core (b, b') (c, c')
forall (a :: BinEff).
Category a
-> (forall b c. (b -> c) -> a b c)
-> (forall b c d. a b c -> a (b, d) (c, d))
-> (forall b c d. a b c -> a (d, b) (d, c))
-> (forall b c b' c'. a b c -> a b' c' -> a (b, b') (c, c'))
-> (forall b c c'. a b c -> a b c' -> a b (c, c'))
-> Arrow a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Arrow core =>
Category (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
Arrow core =>
(b -> c) -> RopeRunner record mantle interp core b c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (b, d) (c, d)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (d, b) (d, c)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c c'.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c'
-> RopeRunner record mantle interp core b (c, c')
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c b' c'.
Arrow core =>
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')
$c&&& :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c c'.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c'
-> RopeRunner record mantle interp core b (c, c')
*** :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b' c'
-> RopeRunner record mantle interp core (b, b') (c, c')
$c*** :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c b' c'.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b' c'
-> RopeRunner record mantle interp core (b, b') (c, c')
second :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (d, b) (d, c)
$csecond :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (d, b) (d, c)
first :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (b, d) (c, d)
$cfirst :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
Arrow core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (b, d) (c, d)
arr :: (b -> c) -> RopeRunner record mantle interp core b c
$carr :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
Arrow core =>
(b -> c) -> RopeRunner record mantle interp core b c
$cp1Arrow :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Arrow core =>
Category (RopeRunner record mantle interp core)
Arrow, Arrow (RopeRunner record mantle interp core)
Arrow (RopeRunner record mantle interp core)
-> (forall b c d.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core (Either b d) (Either c d))
-> (forall b c d.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core (Either d b) (Either d c))
-> (forall b c b' 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'))
-> (forall b d c.
    RopeRunner record mantle interp core b d
    -> RopeRunner record mantle interp core c d
    -> RopeRunner record mantle interp core (Either b c) d)
-> ArrowChoice (RopeRunner record mantle interp core)
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either b d) (Either c d)
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
forall b c d.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either b d) (Either c d)
forall b c d.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either d b) (Either d c)
forall b d c.
RopeRunner record mantle interp core b d
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core (Either b c) d
forall b c b' 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')
forall (a :: BinEff).
Arrow a
-> (forall b c d. a b c -> a (Either b d) (Either c d))
-> (forall b c d. a b c -> a (Either d b) (Either d c))
-> (forall b c b' c'.
    a b c -> a b' c' -> a (Either b b') (Either c c'))
-> (forall b d c. a b d -> a c d -> a (Either b c) d)
-> ArrowChoice a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowChoice core =>
Arrow (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
ArrowChoice core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either b d) (Either c d)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
ArrowChoice core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either d b) (Either d c)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b d c.
ArrowChoice core =>
RopeRunner record mantle interp core b d
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core (Either b c) d
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c b' c'.
ArrowChoice core =>
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
$c||| :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b d c.
ArrowChoice core =>
RopeRunner record mantle interp core b d
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core (Either b c) d
+++ :: 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')
$c+++ :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c b' c'.
ArrowChoice core =>
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')
right :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either d b) (Either d c)
$cright :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
ArrowChoice core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either d b) (Either d c)
left :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either b d) (Either c d)
$cleft :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c d.
ArrowChoice core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core (Either b d) (Either c d)
$cp1ArrowChoice :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowChoice core =>
Arrow (RopeRunner record mantle interp core)
ArrowChoice, Arrow (RopeRunner record mantle interp core)
Arrow (RopeRunner record mantle interp core)
-> (forall b d c.
    RopeRunner record mantle interp core (b, d) (c, d)
    -> RopeRunner record mantle interp core b c)
-> ArrowLoop (RopeRunner record mantle interp core)
RopeRunner record mantle interp core (b, d) (c, d)
-> RopeRunner record mantle interp core b c
forall b d c.
RopeRunner record mantle interp core (b, d) (c, d)
-> RopeRunner record mantle interp core b c
forall (a :: BinEff).
Arrow a -> (forall b d c. a (b, d) (c, d) -> a b c) -> ArrowLoop a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowLoop core =>
Arrow (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b d c.
ArrowLoop core =>
RopeRunner record mantle interp core (b, d) (c, d)
-> RopeRunner record mantle interp core b c
loop :: RopeRunner record mantle interp core (b, d) (c, d)
-> RopeRunner record mantle interp core b c
$cloop :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b d c.
ArrowLoop core =>
RopeRunner record mantle interp core (b, d) (c, d)
-> RopeRunner record mantle interp core b c
$cp1ArrowLoop :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowLoop core =>
Arrow (RopeRunner record mantle interp core)
ArrowLoop, Arrow (RopeRunner record mantle interp core)
RopeRunner record mantle interp core b c
Arrow (RopeRunner record mantle interp core)
-> (forall b c. RopeRunner record mantle interp core b c)
-> ArrowZero (RopeRunner record mantle interp core)
forall b c. RopeRunner record mantle interp core b c
forall (a :: BinEff). Arrow a -> (forall b c. a b c) -> ArrowZero a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowZero core =>
Arrow (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
ArrowZero core =>
RopeRunner record mantle interp core b c
zeroArrow :: RopeRunner record mantle interp core b c
$czeroArrow :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
ArrowZero core =>
RopeRunner record mantle interp core b c
$cp1ArrowZero :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowZero core =>
Arrow (RopeRunner record mantle interp core)
ArrowZero, ArrowZero (RopeRunner record mantle interp core)
ArrowZero (RopeRunner record mantle interp core)
-> (forall b c.
    RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core b c)
-> ArrowPlus (RopeRunner record mantle interp core)
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
forall b c.
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
forall (a :: BinEff).
ArrowZero a -> (forall b c. a b c -> a b c -> a b c) -> ArrowPlus a
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowPlus core =>
ArrowZero (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
ArrowPlus core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
<+> :: RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
$c<+> :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c.
ArrowPlus core =>
RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core b c
$cp1ArrowPlus :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
ArrowPlus core =>
ArrowZero (RopeRunner record mantle interp core)
ArrowPlus
           , q b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
RopeRunner record mantle interp core b c
-> q a b -> RopeRunner record mantle interp core a c
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a d
(a -> b)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a c
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
(forall a b c d.
 (a -> b)
 -> (c -> d)
 -> RopeRunner record mantle interp core b c
 -> RopeRunner record mantle interp core a d)
-> (forall a b c.
    (a -> b)
    -> RopeRunner record mantle interp core b c
    -> RopeRunner record mantle interp core a c)
-> (forall b c a.
    (b -> c)
    -> RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core a c)
-> (forall a b c (q :: BinEff).
    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 :: BinEff).
    Coercible b a =>
    RopeRunner record mantle interp core b c
    -> q a b -> RopeRunner record mantle interp core a c)
-> Profunctor (RopeRunner record mantle interp core)
forall a b c.
(a -> b)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a c
forall b c a.
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall a b c d.
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a d
forall a b c (q :: BinEff).
Coercible b a =>
RopeRunner record mantle interp core b c
-> q a b -> RopeRunner record mantle interp core a c
forall a b c (q :: BinEff).
Coercible c b =>
q b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall (p :: BinEff).
(forall a b c d. (a -> b) -> (c -> d) -> p b c -> p a d)
-> (forall a b c. (a -> b) -> p b c -> p a c)
-> (forall b c a. (b -> c) -> p a b -> p a c)
-> (forall a b c (q :: BinEff).
    Coercible c b =>
    q b c -> p a b -> p a c)
-> (forall a b c (q :: BinEff).
    Coercible b a =>
    p b c -> q a b -> p a c)
-> Profunctor p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Profunctor core =>
(a -> b)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Profunctor core =>
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Profunctor core =>
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a d
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c (q :: BinEff).
(Profunctor core, Coercible b a) =>
RopeRunner record mantle interp core b c
-> q a b -> RopeRunner record mantle interp core a c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c (q :: BinEff).
(Profunctor core, Coercible c b) =>
q b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
.# :: RopeRunner record mantle interp core b c
-> q a b -> RopeRunner record mantle interp core a c
$c.# :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c (q :: BinEff).
(Profunctor core, Coercible b a) =>
RopeRunner record mantle interp core b c
-> q a b -> RopeRunner record mantle interp core a c
#. :: q b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
$c#. :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c (q :: BinEff).
(Profunctor core, Coercible c b) =>
q b c
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
rmap :: (b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
$crmap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Profunctor core =>
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
lmap :: (a -> b)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a c
$clmap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Profunctor core =>
(a -> b)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a c
dimap :: (a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a d
$cdimap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Profunctor core =>
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core b c
-> RopeRunner record mantle interp core a d
Profunctor, Profunctor (RopeRunner record mantle interp core)
Profunctor (RopeRunner record mantle interp core)
-> (forall a b c.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (a, c) (b, c))
-> (forall a b c.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (c, a) (c, b))
-> Strong (RopeRunner record mantle interp core)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (a, c) (b, c)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (c, a) (c, b)
forall a b c.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (a, c) (b, c)
forall a b c.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (c, a) (c, b)
forall (p :: BinEff).
Profunctor p
-> (forall a b c. p a b -> p (a, c) (b, c))
-> (forall a b c. p a b -> p (c, a) (c, b))
-> Strong p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Strong core =>
Profunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Strong core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (a, c) (b, c)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Strong core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (c, a) (c, b)
second' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (c, a) (c, b)
$csecond' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Strong core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (c, a) (c, b)
first' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (a, c) (b, c)
$cfirst' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Strong core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (a, c) (b, c)
$cp1Strong :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Strong core =>
Profunctor (RopeRunner record mantle interp core)
Strong, Profunctor (RopeRunner record mantle interp core)
Profunctor (RopeRunner record mantle interp core)
-> (forall a b c.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (Either a c) (Either b c))
-> (forall a b c.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (Either c a) (Either c b))
-> Choice (RopeRunner record mantle interp core)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either a c) (Either b c)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either c a) (Either c b)
forall a b c.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either a c) (Either b c)
forall a b c.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either c a) (Either c b)
forall (p :: BinEff).
Profunctor p
-> (forall a b c. p a b -> p (Either a c) (Either b c))
-> (forall a b c. p a b -> p (Either c a) (Either c b))
-> Choice p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Choice core =>
Profunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Choice core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either a c) (Either b c)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Choice core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either c a) (Either c b)
right' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either c a) (Either c b)
$cright' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Choice core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either c a) (Either c b)
left' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either a c) (Either b c)
$cleft' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Choice core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (Either a c) (Either b c)
$cp1Choice :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Choice core =>
Profunctor (RopeRunner record mantle interp core)
Choice, Profunctor (RopeRunner record mantle interp core)
Profunctor (RopeRunner record mantle interp core)
-> (forall a b x.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (x -> a) (x -> b))
-> Closed (RopeRunner record mantle interp core)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (x -> a) (x -> b)
forall a b x.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (x -> a) (x -> b)
forall (p :: BinEff).
Profunctor p
-> (forall a b x. p a b -> p (x -> a) (x -> b)) -> Closed p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Closed core =>
Profunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b x.
Closed core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (x -> a) (x -> b)
closed :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (x -> a) (x -> b)
$cclosed :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b x.
Closed core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (x -> a) (x -> b)
$cp1Closed :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Closed core =>
Profunctor (RopeRunner record mantle interp core)
Closed, Profunctor (RopeRunner record mantle interp core)
Profunctor (RopeRunner record mantle interp core)
-> (forall a d b.
    RopeRunner record mantle interp core (a, d) (b, d)
    -> RopeRunner record mantle interp core a b)
-> (forall d a b.
    RopeRunner record mantle interp core (d, a) (d, b)
    -> RopeRunner record mantle interp core a b)
-> Costrong (RopeRunner record mantle interp core)
RopeRunner record mantle interp core (a, d) (b, d)
-> RopeRunner record mantle interp core a b
RopeRunner record mantle interp core (d, a) (d, b)
-> RopeRunner record mantle interp core a b
forall d a b.
RopeRunner record mantle interp core (d, a) (d, b)
-> RopeRunner record mantle interp core a b
forall a d b.
RopeRunner record mantle interp core (a, d) (b, d)
-> RopeRunner record mantle interp core a b
forall (p :: BinEff).
Profunctor p
-> (forall a d b. p (a, d) (b, d) -> p a b)
-> (forall d a b. p (d, a) (d, b) -> p a b)
-> Costrong p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Costrong core =>
Profunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) d a b.
Costrong core =>
RopeRunner record mantle interp core (d, a) (d, b)
-> RopeRunner record mantle interp core a b
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a d b.
Costrong core =>
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
$cunsecond :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) d a b.
Costrong core =>
RopeRunner record mantle interp core (d, a) (d, b)
-> RopeRunner record mantle interp core a b
unfirst :: RopeRunner record mantle interp core (a, d) (b, d)
-> RopeRunner record mantle interp core a b
$cunfirst :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a d b.
Costrong core =>
RopeRunner record mantle interp core (a, d) (b, d)
-> RopeRunner record mantle interp core a b
$cp1Costrong :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Costrong core =>
Profunctor (RopeRunner record mantle interp core)
Costrong, Profunctor (RopeRunner record mantle interp core)
Profunctor (RopeRunner record mantle interp core)
-> (forall a d b.
    RopeRunner record mantle interp core (Either a d) (Either b d)
    -> RopeRunner record mantle interp core a b)
-> (forall d a b.
    RopeRunner record mantle interp core (Either d a) (Either d b)
    -> RopeRunner record mantle interp core a b)
-> Cochoice (RopeRunner record mantle interp core)
RopeRunner record mantle interp core (Either a d) (Either b d)
-> RopeRunner record mantle interp core a b
RopeRunner record mantle interp core (Either d a) (Either d b)
-> RopeRunner record mantle interp core a b
forall d a b.
RopeRunner record mantle interp core (Either d a) (Either d b)
-> RopeRunner record mantle interp core a b
forall a d b.
RopeRunner record mantle interp core (Either a d) (Either b d)
-> RopeRunner record mantle interp core a b
forall (p :: BinEff).
Profunctor p
-> (forall a d b. p (Either a d) (Either b d) -> p a b)
-> (forall d a b. p (Either d a) (Either d b) -> p a b)
-> Cochoice p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Cochoice core =>
Profunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) d a b.
Cochoice core =>
RopeRunner record mantle interp core (Either d a) (Either d b)
-> RopeRunner record mantle interp core a b
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a d b.
Cochoice core =>
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
$cunright :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) d a b.
Cochoice core =>
RopeRunner record mantle interp core (Either d a) (Either d b)
-> RopeRunner record mantle interp core a b
unleft :: RopeRunner record mantle interp core (Either a d) (Either b d)
-> RopeRunner record mantle interp core a b
$cunleft :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a d b.
Cochoice core =>
RopeRunner record mantle interp core (Either a d) (Either b d)
-> RopeRunner record mantle interp core a b
$cp1Cochoice :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Cochoice core =>
Profunctor (RopeRunner record mantle interp core)
Cochoice
           , Traversing (RopeRunner record mantle interp core)
Closed (RopeRunner record mantle interp core)
Traversing (RopeRunner record mantle interp core)
-> Closed (RopeRunner record mantle interp core)
-> (forall (f :: * -> *) a b.
    Functor f =>
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (f a) (f b))
-> (forall a b s t.
    ((a -> b) -> s -> t)
    -> RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core s t)
-> Mapping (RopeRunner record mantle interp core)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
((a -> b) -> s -> t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall a b s t.
((a -> b) -> s -> t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall (f :: * -> *) a b.
Functor f =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
forall (p :: BinEff).
Traversing p
-> Closed p
-> (forall (f :: * -> *) a b. Functor f => p a b -> p (f a) (f b))
-> (forall a b s t. ((a -> b) -> s -> t) -> p a b -> p s t)
-> Mapping p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Mapping core =>
Traversing (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Mapping core =>
Closed (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b s t.
Mapping core =>
((a -> b) -> s -> t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) (f :: * -> *) a b.
(Mapping core, 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
$croam :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b s t.
Mapping core =>
((a -> b) -> s -> t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
map' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
$cmap' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) (f :: * -> *) a b.
(Mapping core, Functor f) =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
$cp2Mapping :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Mapping core =>
Closed (RopeRunner record mantle interp core)
$cp1Mapping :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Mapping core =>
Traversing (RopeRunner record mantle interp core)
Mapping, Choice (RopeRunner record mantle interp core)
Strong (RopeRunner record mantle interp core)
Choice (RopeRunner record mantle interp core)
-> Strong (RopeRunner record mantle interp core)
-> (forall (f :: * -> *) a b.
    Traversable f =>
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core (f a) (f b))
-> (forall a b s t.
    (forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
    -> RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core s t)
-> Traversing (RopeRunner record mantle interp core)
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
(forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall a b s t.
(forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall (f :: * -> *) a b.
Traversable f =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
forall (p :: BinEff).
Choice p
-> Strong p
-> (forall (f :: * -> *) a b.
    Traversable f =>
    p a b -> p (f a) (f b))
-> (forall a b s t.
    (forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
    -> p a b -> p s t)
-> Traversing p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Traversing core =>
Choice (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Traversing core =>
Strong (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b s t.
Traversing core =>
(forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) (f :: * -> *) a b.
(Traversing core, Traversable f) =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
wander :: (forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
$cwander :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b s t.
Traversing core =>
(forall (f :: * -> *). Applicative f => (a -> f b) -> s -> f t)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core s t
traverse' :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
$ctraverse' :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) (f :: * -> *) a b.
(Traversing core, Traversable f) =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core (f a) (f b)
$cp2Traversing :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Traversing core =>
Strong (RopeRunner record mantle interp core)
$cp1Traversing :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Traversing core =>
Choice (RopeRunner record mantle interp core)
Traversing
           , ThrowEffect ex, TryEffect ex
           , SieveTrans f, HasAutoIdent eff )
    via Cayley ((->) (record (Weaver interp) mantle)) core
  deriving ((p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
(forall (p :: BinEff) (q :: BinEff).
 Profunctor p =>
 (p :-> q)
 -> RopeRunner record mantle interp p
    :-> RopeRunner record mantle interp q)
-> ProfunctorFunctor (RopeRunner record mantle interp)
forall k k1 (t :: BinEff -> k -> k1 -> *).
(forall (p :: BinEff) (q :: BinEff).
 Profunctor p =>
 (p :-> q) -> t p :-> t q)
-> ProfunctorFunctor t
forall (p :: BinEff) (q :: BinEff).
Profunctor p =>
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff) (q :: BinEff).
Profunctor p =>
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
promap :: (p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
$cpromap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff) (q :: BinEff).
Profunctor p =>
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
ProfunctorFunctor, ProfunctorFunctor (RopeRunner record mantle interp)
ProfunctorFunctor (RopeRunner record mantle interp)
-> (forall (p :: BinEff).
    Profunctor p =>
    p :-> RopeRunner record mantle interp p)
-> (forall (p :: BinEff).
    Profunctor p =>
    RopeRunner record mantle interp (RopeRunner record mantle interp p)
    :-> RopeRunner record mantle interp p)
-> ProfunctorMonad (RopeRunner record mantle interp)
p :-> RopeRunner record mantle interp p
RopeRunner record mantle interp (RopeRunner record mantle interp p)
:-> RopeRunner record mantle interp p
forall (p :: BinEff).
Profunctor p =>
p :-> RopeRunner record mantle interp p
forall (p :: BinEff).
Profunctor p =>
RopeRunner record mantle interp (RopeRunner record mantle interp p)
:-> RopeRunner record mantle interp p
forall (t :: BinEff -> BinEff).
ProfunctorFunctor t
-> (forall (p :: BinEff). Profunctor p => p :-> t p)
-> (forall (p :: BinEff). Profunctor p => t (t p) :-> t p)
-> ProfunctorMonad t
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand]).
ProfunctorFunctor (RopeRunner record mantle interp)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff).
Profunctor p =>
p :-> RopeRunner record mantle interp p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff).
Profunctor p =>
RopeRunner record mantle interp (RopeRunner record mantle interp p)
:-> RopeRunner record mantle interp p
projoin :: RopeRunner record mantle interp (RopeRunner record mantle interp p)
:-> RopeRunner record mantle interp p
$cprojoin :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff).
Profunctor p =>
RopeRunner record mantle interp (RopeRunner record mantle interp p)
:-> RopeRunner record mantle interp p
proreturn :: p :-> RopeRunner record mantle interp p
$cproreturn :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff).
Profunctor p =>
p :-> RopeRunner record mantle interp p
$cp1ProfunctorMonad :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand]).
ProfunctorFunctor (RopeRunner record mantle interp)
ProfunctorMonad)
    via Cayley ((->) (record (Weaver interp) mantle))

  deriving ((a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
(a -> b)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b c
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
(forall a b c d.
 (a -> b)
 -> (c -> d)
 -> RopeRunner record mantle interp core a c
 -> RopeRunner record mantle interp core b d)
-> (forall a b c.
    (a -> b)
    -> RopeRunner record mantle interp core a c
    -> RopeRunner record mantle interp core b c)
-> (forall b c a.
    (b -> c)
    -> RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core a c)
-> Bifunctor (RopeRunner record mantle interp core)
forall a b c.
(a -> b)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b c
forall b c a.
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall a b c d.
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
forall (p :: BinEff).
(forall a b c d. (a -> b) -> (c -> d) -> p a c -> p b d)
-> (forall a b c. (a -> b) -> p a c -> p b c)
-> (forall b c a. (b -> c) -> p a b -> p a c)
-> Bifunctor p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Bifunctor core =>
(a -> b)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Bifunctor core =>
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Bifunctor core =>
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
second :: (b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
$csecond :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) b c a.
Bifunctor core =>
(b -> c)
-> RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core a c
first :: (a -> b)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b c
$cfirst :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c.
Bifunctor core =>
(a -> b)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b c
bimap :: (a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
$cbimap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Bifunctor core =>
(a -> b)
-> (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
Bifunctor, Bifunctor (RopeRunner record mantle interp core)
a -> b -> RopeRunner record mantle interp core a b
Bifunctor (RopeRunner record mantle interp core)
-> (forall a b. a -> b -> RopeRunner record mantle interp core a b)
-> (forall a b c d.
    RopeRunner record mantle interp core (a -> b) (c -> d)
    -> RopeRunner record mantle interp core a c
    -> RopeRunner record mantle interp core b d)
-> (forall a b c d e f.
    (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)
-> (forall a b c d.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core c d
    -> RopeRunner record mantle interp core c d)
-> (forall a b c d.
    RopeRunner record mantle interp core a b
    -> RopeRunner record mantle interp core c d
    -> RopeRunner record mantle interp core a b)
-> Biapplicative (RopeRunner record mantle interp core)
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
RopeRunner record mantle interp core (a -> b) (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
(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
forall a b. a -> b -> RopeRunner record mantle interp core a b
forall a b c d.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core a b
forall a b c d.
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core c d
forall a b c d.
RopeRunner record mantle interp core (a -> b) (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
forall a b c d e f.
(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
forall (p :: BinEff).
Bifunctor p
-> (forall a b. a -> b -> p a b)
-> (forall a b c d. p (a -> b) (c -> d) -> p a c -> p b d)
-> (forall a b c d e f.
    (a -> b -> c) -> (d -> e -> f) -> p a d -> p b e -> p c f)
-> (forall a b c d. p a b -> p c d -> p c d)
-> (forall a b c d. p a b -> p c d -> p a b)
-> Biapplicative p
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Biapplicative core =>
Bifunctor (RopeRunner record mantle interp core)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b.
Biapplicative core =>
a -> b -> RopeRunner record mantle interp core a b
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core a b
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core c d
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core (a -> b) (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d e f.
Biapplicative core =>
(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 a b
$c<<* :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core a b
*>> :: RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core c d
$c*>> :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core a b
-> RopeRunner record mantle interp core c d
-> RopeRunner record mantle interp core c 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
$cbiliftA2 :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d e f.
Biapplicative core =>
(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) (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
$c<<*>> :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b c d.
Biapplicative core =>
RopeRunner record mantle interp core (a -> b) (c -> d)
-> RopeRunner record mantle interp core a c
-> RopeRunner record mantle interp core b d
bipure :: a -> b -> RopeRunner record mantle interp core a b
$cbipure :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff) a b.
Biapplicative core =>
a -> b -> RopeRunner record mantle interp core a b
$cp1Biapplicative :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (core :: BinEff).
Biapplicative core =>
Bifunctor (RopeRunner record mantle interp core)
Biapplicative)
    via Tannen ((->) (record (Weaver interp) mantle)) core
  deriving ((p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
(forall (p :: BinEff) (q :: BinEff).
 (p :-> q)
 -> RopeRunner record mantle interp p
    :-> RopeRunner record mantle interp q)
-> BifunctorFunctor (RopeRunner record mantle interp)
forall k k1 k2 k3 (t :: (k -> k1 -> *) -> k2 -> k3 -> *).
(forall (p :: k -> k1 -> *) (q :: k -> k1 -> *).
 (p :-> q) -> t p :-> t q)
-> BifunctorFunctor t
forall (p :: BinEff) (q :: BinEff).
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff) (q :: BinEff).
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
bifmap :: (p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
$cbifmap :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (p :: BinEff) (q :: BinEff).
(p :-> q)
-> RopeRunner record mantle interp p
   :-> RopeRunner record mantle interp q
EffFunctor, EffFunctor (RopeRunner record mantle interp)
eff a b -> RopeRunner record mantle interp eff a b
EffFunctor (RopeRunner record mantle interp)
-> (forall (eff :: BinEff).
    eff :-> RopeRunner record mantle interp eff)
-> EffPointedFunctor (RopeRunner record mantle interp)
forall (eff :: BinEff). eff :-> RopeRunner record mantle interp eff
forall (f :: BinEff -> BinEff).
EffFunctor f
-> (forall (eff :: BinEff). eff :-> f eff) -> EffPointedFunctor f
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand]).
EffFunctor (RopeRunner record mantle interp)
forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (eff :: BinEff).
eff :-> RopeRunner record mantle interp eff
effpure :: eff a b -> RopeRunner record mantle interp eff a b
$ceffpure :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand])
       (eff :: BinEff).
eff :-> RopeRunner record mantle interp eff
$cp1EffPointedFunctor :: forall (record :: RopeRec) (interp :: BinEff) (mantle :: [Strand]).
EffFunctor (RopeRunner record mantle interp)
EffPointedFunctor)
    via Tannen ((->) (record (Weaver interp) mantle))

instance (RMap m) => EffProfunctor (RopeRunner Rec m) where
  effdimap :: (a' :-> a)
-> (b :-> b') -> RopeRunner Rec m a b :-> RopeRunner Rec m a' b'
effdimap a' :-> a
f b :-> b'
g (RopeRunner Rec (Weaver a) m -> b a b
run) = (Rec (Weaver a') m -> b' a b) -> RopeRunner Rec m a' b' a b
forall (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff)
       (core :: BinEff) a b.
(record (Weaver interp) mantle -> core a b)
-> RopeRunner record mantle interp core a b
RopeRunner ((Rec (Weaver a') m -> b' a b) -> RopeRunner Rec m a' b' a b)
-> (Rec (Weaver a') m -> b' a b) -> RopeRunner Rec m a' b' a b
forall a b. (a -> b) -> a -> b
$
    b a b -> b' a b
b :-> b'
g (b a b -> b' a b)
-> (Rec (Weaver a') m -> b a b) -> Rec (Weaver a') m -> b' a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rec (Weaver a) m -> b a b
run (Rec (Weaver a) m -> b a b)
-> (Rec (Weaver a') m -> Rec (Weaver a) m)
-> Rec (Weaver a') m
-> b a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (forall (x :: Strand). Weaver a' x -> Weaver a x)
-> Rec (Weaver a') m -> Rec (Weaver a) m
forall u (rs :: [u]) (f :: u -> *) (g :: u -> *).
RMap rs =>
(forall (x :: u). f x -> g x) -> Rec f rs -> Rec g rs
rmap ((a' :-> a) -> Weaver a' x -> Weaver a x
forall (interp :: BinEff) (interp' :: BinEff) (strand :: Strand).
(interp :-> interp')
-> Weaver interp strand -> Weaver interp' strand
mapWeaverInterp a' :-> a
f)
  {-# INLINE effdimap #-}

-- | Splits a 'RopeRunner' in two parts, so we can select several strands to act on
splitRopeRunner :: RopeRunner Rec (mantle1 ++ mantle2) interp core
               :-> RopeRunner Rec mantle1 interp (RopeRunner Rec mantle2 interp core)
splitRopeRunner :: RopeRunner Rec (mantle1 ++ mantle2) interp core a b
-> RopeRunner
     Rec mantle1 interp (RopeRunner Rec mantle2 interp core) a b
splitRopeRunner (RopeRunner Rec (Weaver interp) (mantle1 ++ mantle2) -> core a b
f) = (Rec (Weaver interp) mantle1
 -> RopeRunner Rec mantle2 interp core a b)
-> RopeRunner
     Rec mantle1 interp (RopeRunner Rec mantle2 interp core) a b
forall (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff)
       (core :: BinEff) a b.
(record (Weaver interp) mantle -> core a b)
-> RopeRunner record mantle interp core a b
RopeRunner ((Rec (Weaver interp) mantle1
  -> RopeRunner Rec mantle2 interp core a b)
 -> RopeRunner
      Rec mantle1 interp (RopeRunner Rec mantle2 interp core) a b)
-> (Rec (Weaver interp) mantle1
    -> RopeRunner Rec mantle2 interp core a b)
-> RopeRunner
     Rec mantle1 interp (RopeRunner Rec mantle2 interp core) a b
forall a b. (a -> b) -> a -> b
$ \Rec (Weaver interp) mantle1
r1 -> (Rec (Weaver interp) mantle2 -> core a b)
-> RopeRunner Rec mantle2 interp core a b
forall (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff)
       (core :: BinEff) a b.
(record (Weaver interp) mantle -> core a b)
-> RopeRunner record mantle interp core a b
RopeRunner ((Rec (Weaver interp) mantle2 -> core a b)
 -> RopeRunner Rec mantle2 interp core a b)
-> (Rec (Weaver interp) mantle2 -> core a b)
-> RopeRunner Rec mantle2 interp core a b
forall a b. (a -> b) -> a -> b
$ \Rec (Weaver interp) mantle2
r2 ->
  Rec (Weaver interp) (mantle1 ++ mantle2) -> core a b
f (Rec (Weaver interp) (mantle1 ++ mantle2) -> core a b)
-> Rec (Weaver interp) (mantle1 ++ mantle2) -> core a b
forall a b. (a -> b) -> a -> b
$ Rec (Weaver interp) mantle1
r1 Rec (Weaver interp) mantle1
-> Rec (Weaver interp) mantle2
-> Rec (Weaver interp) (mantle1 ++ mantle2)
forall k (f :: k -> *) (as :: [k]) (bs :: [k]).
Rec f as -> Rec f bs -> Rec f (as ++ bs)
`rappend` Rec (Weaver interp) mantle2
r2

-- | Indicates that @strands@ can be reordered and considered a subset of
-- @strands'@
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
joinRopeRunner :: RopeRunner r mantle1 interp (RopeRunner r mantle2 interp core)
:-> RopeRunner r mantle interp core
joinRopeRunner (RopeRunner r (Weaver interp) mantle1 -> RopeRunner r mantle2 interp core a b
f) = (r (Weaver interp) mantle -> core a b)
-> RopeRunner r mantle interp core a b
forall (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff)
       (core :: BinEff) a b.
(record (Weaver interp) mantle -> core a b)
-> RopeRunner record mantle interp core a b
RopeRunner ((r (Weaver interp) mantle -> core a b)
 -> RopeRunner r mantle interp core a b)
-> (r (Weaver interp) mantle -> core a b)
-> RopeRunner r mantle interp core a b
forall a b. (a -> b) -> a -> b
$ \r (Weaver interp) mantle
r -> case r (Weaver interp) mantle1 -> RopeRunner r mantle2 interp core a b
f (r (Weaver interp) mantle -> r (Weaver interp) mantle1
forall k1 k2 (rs :: [k1]) (ss :: [k1]) (f :: k2 -> *)
       (record :: (k2 -> *) -> [k1] -> *) (is :: [Nat]).
(RecSubset record rs ss is, RecSubsetFCtx record f) =>
record f ss -> record f rs
rcast r (Weaver interp) mantle
r) of
  RopeRunner r (Weaver interp) mantle2 -> core a b
f' -> r (Weaver interp) mantle2 -> core a b
f' (r (Weaver interp) mantle -> r (Weaver interp) mantle2
forall k1 k2 (rs :: [k1]) (ss :: [k1]) (f :: k2 -> *)
       (record :: (k2 -> *) -> [k1] -> *) (is :: [Nat]).
(RecSubset record rs ss is, RecSubsetFCtx record f) =>
record f ss -> record f rs
rcast r (Weaver interp) mantle
r)

-- | Wrap each strand effect inside a type constructor
type family MapStrandEffs f mantle where
  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)
effmapRopeRec :: Rec (Weaver interp) strands
-> Rec (Weaver (f interp)) (MapStrandEffs f strands)
effmapRopeRec Rec (Weaver interp) strands
RNil = Rec (Weaver (f interp)) (MapStrandEffs f strands)
forall u (a :: u -> *). Rec a '[]
RNil
effmapRopeRec (Weaver StrandEff r :-> interp
w :& Rec (Weaver interp) rs
rest) = (StrandEff '(StrandName r, f (StrandEff r)) :-> f interp)
-> Weaver (f interp) '(StrandName r, f (StrandEff r))
forall (interp :: BinEff) (strand :: Strand).
(StrandEff strand :-> interp) -> Weaver interp strand
Weaver ((StrandEff r :-> interp) -> f (StrandEff r) :-> f interp
forall (f :: BinEff -> BinEff) (eff :: BinEff) (eff' :: BinEff).
EffFunctor f =>
(eff :-> eff') -> f eff :-> f eff'
effrmap StrandEff r :-> interp
w) Weaver (f interp) '(StrandName r, f (StrandEff r))
-> Rec (Weaver (f interp)) (MapStrandEffs f rs)
-> Rec
     (Weaver (f interp))
     ('(StrandName r, f (StrandEff r)) : MapStrandEffs f rs)
forall u (a :: u -> *) (r :: u) (rs :: [u]).
a r -> Rec a rs -> Rec a (r : rs)
:& Rec (Weaver interp) rs
-> Rec (Weaver (f interp)) (MapStrandEffs f rs)
forall (f :: BinEff -> BinEff) (interp :: BinEff)
       (strands :: [Strand]).
EffFunctor f =>
Rec (Weaver interp) strands
-> Rec (Weaver (f interp)) (MapStrandEffs f strands)
effmapRopeRec Rec (Weaver interp) rs
rest

-- | 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'
unwrapRopeRunner :: (EffFunctor f)
                 => RopeRunner Rec (MapStrandEffs f strands) (f core) core
                :-> RopeRunner Rec strands core core
unwrapRopeRunner :: RopeRunner Rec (MapStrandEffs f strands) (f core) core
:-> RopeRunner Rec strands core core
unwrapRopeRunner (RopeRunner Rec (Weaver (f core)) (MapStrandEffs f strands) -> core a b
f) = (Rec (Weaver core) strands -> core a b)
-> RopeRunner Rec strands core core a b
forall (record :: RopeRec) (mantle :: [Strand]) (interp :: BinEff)
       (core :: BinEff) a b.
(record (Weaver interp) mantle -> core a b)
-> RopeRunner record mantle interp core a b
RopeRunner ((Rec (Weaver core) strands -> core a b)
 -> RopeRunner Rec strands core core a b)
-> (Rec (Weaver core) strands -> core a b)
-> RopeRunner Rec strands core core a b
forall a b. (a -> b) -> a -> b
$ Rec (Weaver (f core)) (MapStrandEffs f strands) -> core a b
f (Rec (Weaver (f core)) (MapStrandEffs f strands) -> core a b)
-> (Rec (Weaver core) strands
    -> Rec (Weaver (f core)) (MapStrandEffs f strands))
-> Rec (Weaver core) strands
-> core a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Rec (Weaver core) strands
-> Rec (Weaver (f core)) (MapStrandEffs f strands)
forall (f :: BinEff -> BinEff) (interp :: BinEff)
       (strands :: [Strand]).
EffFunctor f =>
Rec (Weaver interp) strands
-> Rec (Weaver (f interp)) (MapStrandEffs f strands)
effmapRopeRec
{-# INLINE unwrapRopeRunner #-}

unwrapSomeStrands :: (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 
unwrapSomeStrands :: (f core' :-> interp)
-> (RopeRunner Rec mantle2 interp core :-> core')
-> RopeRunner Rec (MapStrandEffs f mantle1 ++ mantle2) interp core
   :-> RopeRunner Rec mantle1 core' core'
unwrapSomeStrands f core' :-> interp
f RopeRunner Rec mantle2 interp core :-> core'
g = RopeRunner Rec (MapStrandEffs f mantle1) (f core') core' a b
-> RopeRunner Rec mantle1 core' core' a b
forall (f :: BinEff -> BinEff) (strands :: [Strand])
       (core :: BinEff).
EffFunctor f =>
RopeRunner Rec (MapStrandEffs f strands) (f core) core
:-> RopeRunner Rec strands core core
unwrapRopeRunner (RopeRunner Rec (MapStrandEffs f mantle1) (f core') core' a b
 -> RopeRunner Rec mantle1 core' core' a b)
-> (RopeRunner
      Rec (MapStrandEffs f mantle1 ++ mantle2) interp core a b
    -> RopeRunner Rec (MapStrandEffs f mantle1) (f core') core' a b)
-> RopeRunner
     Rec (MapStrandEffs f mantle1 ++ mantle2) interp core a b
-> RopeRunner Rec mantle1 core' core' a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (f core' :-> interp)
-> (RopeRunner Rec mantle2 interp core :-> core')
-> RopeRunner
     Rec
     (MapStrandEffs f mantle1)
     interp
     (RopeRunner Rec mantle2 interp core)
   :-> RopeRunner Rec (MapStrandEffs f mantle1) (f core') core'
forall (p :: BinEff -> BinEff -> BinEff) (a' :: BinEff)
       (a :: BinEff) (b :: BinEff) (b' :: BinEff).
EffProfunctor p =>
(a' :-> a) -> (b :-> b') -> p a b :-> p a' b'
effdimap f core' :-> interp
f RopeRunner Rec mantle2 interp core :-> core'
g (RopeRunner
   Rec
   (MapStrandEffs f mantle1)
   interp
   (RopeRunner Rec mantle2 interp core)
   a
   b
 -> RopeRunner Rec (MapStrandEffs f mantle1) (f core') core' a b)
-> (RopeRunner
      Rec (MapStrandEffs f mantle1 ++ mantle2) interp core a b
    -> RopeRunner
         Rec
         (MapStrandEffs f mantle1)
         interp
         (RopeRunner Rec mantle2 interp core)
         a
         b)
-> RopeRunner
     Rec (MapStrandEffs f mantle1 ++ mantle2) interp core a b
-> RopeRunner Rec (MapStrandEffs f mantle1) (f core') core' a b
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. RopeRunner Rec (MapStrandEffs f mantle1 ++ mantle2) interp core a b
-> RopeRunner
     Rec
     (MapStrandEffs f mantle1)
     interp
     (RopeRunner Rec mantle2 interp core)
     a
     b
forall (mantle1 :: [Strand]) (mantle2 :: [Strand])
       (interp :: BinEff) (core :: BinEff).
RopeRunner Rec (mantle1 ++ mantle2) interp core
:-> RopeRunner
      Rec mantle1 interp (RopeRunner Rec mantle2 interp core)
splitRopeRunner
{-# INLINE unwrapSomeStrands #-}