| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Circuit.Poly.Channel
Description
Poly-indexed channel type.
A channel is indexed by a polynomial interface p :: Poly. The polynomial
describes both the observable position (output) and the direction space
(input). The channel carries no residual field; any residual policy is
supplied by a Process at composition time.
This module starts with function-category (->) evaluation. The type
Channel arr p keeps arr as a parameter so that future slices can add
Kleisli evaluation helpers without changing the type.
Synopsis
- data Channel (arr :: Type -> Type -> Type) (p :: Poly) where
- emitChannel :: forall (p :: Poly). Channel (->) p -> Eval p ()
- commitChannel :: forall (p :: Poly). Channel (->) p -> Dir p -> Channel (->) p
- idChannel :: a -> Channel (->) (Mono a a)
- constChannel :: b -> Channel (->) (Mono a b)
- mapChannel :: forall (p :: Poly) (q :: Poly). (SystemEval p, SystemEval q) => Morphism p q -> Channel (->) p -> Channel (->) q
Poly-indexed channel
data Channel (arr :: Type -> Type -> Type) (p :: Poly) where Source #
A channel whose interface is the polynomial p.
Internally it is a Moore system with hidden state s. The state is
existentially quantified so that different channel constructors can use
different state types.
Observation and interaction
emitChannel :: forall (p :: Poly). Channel (->) p -> Eval p () Source #
Observe the current output of a (->) channel.
The observation is an Eval p (): a position together with a trivial
direction consumer. The position is the channel's current output; the
direction consumer is how a future input will advance the channel.
commitChannel :: forall (p :: Poly). Channel (->) p -> Dir p -> Channel (->) p Source #
Commit an input direction to a (->) channel, advancing its state.
Constructing channels
idChannel :: a -> Channel (->) (Mono a a) Source #
Identity channel on a monomial interface Mono a a.
Output is the current state; next state is the input direction. An initial state must be supplied because a Moore machine has no input before the first commit.
constChannel :: b -> Channel (->) (Mono a b) Source #
Constant-output channel on a monomial interface Mono a b.
Output is always b; the state is the constant value and is preserved
across commits (the input direction is ignored).
mapChannel :: forall (p :: Poly) (q :: Poly). (SystemEval p, SystemEval q) => Morphism p q -> Channel (->) p -> Channel (->) q Source #
Map a polynomial morphism over a (->) channel.
The forward map transforms positions; the backward map transforms
directions. This is the functorial action of Morphism on
channels.