| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Tools.SMC.Internal.Dialogue
Description
Internal module of Proarrow.Tools.SMC: inputs and outputs in dialogue categories, and duals. It exports everything, also what the public module keeps hidden.
Synopsis
- produce :: forall {k} {p :: CAT k} (a :: SYN k) (d :: Nat). (CompactClosed k, Promonad p, KnownObj a) => TermP p d ('[] :: [(Nat, SYN k)]) (a ':** 'Not a)
- annihilate :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (IsoMix k, MonoidalProfunctor p, KnownObj a, Merge g1 g2) => ConsumerP p d g1 a -> TermP p d g2 a -> TermP p d (Union g1 g2) ('I :: SYN k)
- type ConsumerP (p :: k +-> k) (d :: Nat) (g :: Ctx k) (a :: SYN k) = TermP p d g ('Not a)
- type Consumer (d :: Nat) (g :: Ctx k) (a :: SYN k) = Term d g ('Not a)
- type CommandP (p :: k +-> k) (d :: Nat) (g :: Ctx k) = TermP p d g ('Not ('I :: SYN k))
- type Command (d :: Nat) (g :: Ctx k) = Term d g ('Not ('I :: SYN k))
- type (:##) (a :: SYN k) (b :: SYN k) = 'Not ('Not a ':** 'Not b)
- cut :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (Dialogue k, MonoidalProfunctor p, KnownObj a, Merge g1 g2) => ConsumerP p d g1 a -> TermP p d g2 a -> CommandP p d (Union g1 g2)
- (|>) :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (Dialogue k, MonoidalProfunctor p, KnownObj a, Merge g2 g1) => TermP p d g1 a -> ConsumerP p d g2 a -> CommandP p d (Union g2 g1)
- cont :: forall {k} (d :: Nat) (r :: Ctx k) (a :: SYN k) t cont. (Dialogue k, Binds ((~>) :: CAT k) d r a ('Not ('I :: SYN k)) t cont) => (t -> cont) -> Term d r ('Not a)
- thunk :: forall {k} {p :: CAT k} (n :: SYN k) (d :: Nat) (g :: Ctx k). TermP p d g n -> TermP p d g ('Dn n)
- force :: forall {k} {p :: CAT k} (n :: SYN k) (d :: Nat) (g :: Ctx k). TermP p d g ('Dn n) -> TermP p d g n
- classical :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g :: Ctx k). (StarAutonomous k, Profunctor p, KnownObj a) => TermP p d g (Up a) -> TermP p d g a
Documentation
produce :: forall {k} {p :: CAT k} (a :: SYN k) (d :: Nat). (CompactClosed k, Promonad p, KnownObj a) => TermP p d ('[] :: [(Nat, SYN k)]) (a ':** 'Not a) Source Github #
A new pair of wires, a variable and its dual, from nothing: the unit of the duality. This needs the category to be compact closed.
annihilate :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (IsoMix k, MonoidalProfunctor p, KnownObj a, Merge g1 g2) => ConsumerP p d g1 a -> TermP p d g2 a -> TermP p d (Union g1 g2) ('I :: SYN k) Source Github #
Join a dual and its wire into nothing: the counit of the duality, which an isomix category has.
type ConsumerP (p :: k +-> k) (d :: Nat) (g :: Ctx k) (a :: SYN k) = TermP p d g ('Not a) Source Github #
A consumer of a: a term of its negation.
type CommandP (p :: k +-> k) (d :: Nat) (g :: Ctx k) = TermP p d g ('Not ('I :: SYN k)) Source Github #
A producer and a consumer meeting: a term of the unit of par.
type (:##) (a :: SYN k) (b :: SYN k) = 'Not ('Not a ':** 'Not b) infixl 7 Source Github #
Par, the negation of the tensor of the negations, interpreted as Par.
cut :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (Dialogue k, MonoidalProfunctor p, KnownObj a, Merge g1 g2) => ConsumerP p d g1 a -> TermP p d g2 a -> CommandP p d (Union g1 g2) Source Github #
A consumer meets a producer: cut k t gives t to k, like applying a continuation.
(|>) :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g1 :: Ctx k) (g2 :: Ctx k). (Dialogue k, MonoidalProfunctor p, KnownObj a, Merge g2 g1) => TermP p d g1 a -> ConsumerP p d g2 a -> CommandP p d (Union g2 g1) infixl 1 Source Github #
cut with the producer first, as System L writes ⟨t | k⟩: t |> k sends t into k.
cont :: forall {k} (d :: Nat) (r :: Ctx k) (a :: SYN k) t cont. (Dialogue k, Binds ((~>) :: CAT k) d r a ('Not ('I :: SYN k)) t cont) => (t -> cont) -> Term d r ('Not a) Source Github #
The binder of System L. cont \x -> c is a term of : it receives an Not aa through the
pattern x (see Patterns) and runs the command c with it.
What that a is depends on how the result is used. As a Consumer of a, the a is an input
and cont is μ̃: the seller in a shop receives the order, cont \(name, card, replyTo) -> …. As
a term of the negative type in its own right, the Not aa is the consumer of an output and
cont is μ, Haskell's callCC: a computation receives the consumer of its result,
Up bcont \k -> … |> k; a par b receives a consumer for each side, :## ccont \(kb, kc) -> …;
and a command, , receives nothing, Not Icont \() -> …. A consumer of a par is a
computation, which a nested pair pattern runs to get at the consumers of its sides.
thunk :: forall {k} {p :: CAT k} (n :: SYN k) (d :: Nat) (g :: Ctx k). TermP p d g n -> TermP p d g ('Dn n) Source Github #
force :: forall {k} {p :: CAT k} (n :: SYN k) (d :: Nat) (g :: Ctx k). TermP p d g ('Dn n) -> TermP p d g n Source Github #
classical :: forall {k} {p :: k +-> k} (a :: SYN k) (d :: Nat) (g :: Ctx k). (StarAutonomous k, Profunctor p, KnownObj a) => TermP p d g (Up a) -> TermP p d g a Source Github #
A computation as its value again: double negation elimination, which only a *-autonomous category has. There every type is equivalent to its shift, so the polarities collapse.