| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Shared
Description
Shared-medium fusion: two bodies interleaved on one shared channel.
The connective here is the multiplicative disjunction ⅋ in operational
form: two sub-loops share a single channel, and a Schedule resolves the
interleaving. This is the mixed-mode counterpart to
superpose, which keeps channels independent
(the ⊗ product).
Bias is re-exported from Circuit.Tensor because it is also used for
additive disjunction in Circuit.Poles.
Synopsis
- data Bias
- data Pick
- newtype Schedule s = Schedule {}
- class Tensor t arr => Shared (t :: Type -> Type -> Type) (arr :: Type -> Type -> Type) where
- data SigShared (t :: Type -> Type -> Type) (arr :: k) (rec :: Type -> Type -> Type) i o where
- type AlgShared (t :: Type -> Type -> Type) (arr :: Type -> Type -> Type) = Syntax ((SigCompose :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type) :+: ((SigShared t :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type) :+: (SigYank t :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type))) arr
Schedule bias
Bias for ordered choice in scheduling and additive disjunction.
LeftFirst and RightFirst are used by shared-medium fusion in
Circuit.Shared and by additive disjunction in Circuit.Poles.
Constructors
| LeftFirst | |
| RightFirst |
Schedule decision
A schedule decision: which poles advance on a shared channel.
Schedule driver
A schedule drives shared-medium fusion.
The state s is threaded through the fusion; in typical use it is the
shared channel. At each step the schedule looks at the state and chooses
which poles advance, returning the updated schedule state.
Shared fusion class
class Tensor t arr => Shared (t :: Type -> Type -> Type) (arr :: Type -> Type -> Type) where Source #
Tensors that support shared-medium fusion of two knot bodies.
This is the operational content of the multiplicative disjunction: two
sub-loops share one channel, and a Schedule resolves the interleaving.
Contrast superpose, which keeps the channels independent (⊗).
Methods
sharedBy :: Schedule s -> arr (t s a) (t s b) -> arr (t s c) (t s d) -> arr (t s (t a c)) (t s (These b d)) Source #
Fuse two knot bodies over a shared channel.
The combined body has type arr (t s (t a c)) (t s (These b d)): one
shared state s, paired inputs a and c, and a partial output. At
each step the schedule chooses which body advances; the gated body's
input is discarded and no output is produced for that side.
Instances
Shared-medium fusion signature
data SigShared (t :: Type -> Type -> Type) (arr :: k) (rec :: Type -> Type -> Type) i o where Source #
Shared-medium fusion (the tensor product ⅋), parameterised by a schedule.
The constructor takes two bodies that already share a feedback type s and
produces the untraced shared body. The surrounding SigYank closes the
feedback loop over s, yielding a morphism t a c -> These b d.
Constructors
| SigShared :: forall {k} s (rec :: Type -> Type -> Type) (t :: Type -> Type -> Type) a b c d (arr :: k). Schedule s -> rec (t s a) (t s b) -> rec (t s c) (t s d) -> SigShared t arr rec (t s (t a c)) (t s (These b d)) |
Instances
Free traced category with shared-medium fusion
type AlgShared (t :: Type -> Type -> Type) (arr :: Type -> Type -> Type) = Syntax ((SigCompose :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type) :+: ((SigShared t :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type) :+: (SigYank t :: (Type -> Type -> Type) -> (Type -> Type -> Type) -> Type -> Type -> Type))) arr Source #
Free traced category with shared-medium fusion (the ⅋ connective).