| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Tools.SMC.Internal.Syntax
Description
Internal module of Proarrow.Tools.SMC: the type expressions of terms, and how they stand for objects. It exports everything, also what the public module keeps hidden.
Documentation
Type expressions over the objects of k: an object of k, the unit, the tensor, the
internal hom and the negation, and the additives: the product and its unit Top, and the
coproduct and its unit Zero.
The negation gives the types a polarity: a type is negative when it is a Not, and positive
otherwise. A term of a positive type is a value, and a term of a negative type is a consumer
of what it negates. Up shifts a positive type to a negative one, and Dn a negative type to
a positive one, standing for the same object: a term of is a stored term of Dn nn.
Constructors
| F k | |
| I | |
| (SYN k) :** (SYN k) infixl 7 | |
| (SYN k) :-> (SYN k) infixr 5 | |
| Not (SYN k) | |
| Dn (SYN k) | |
| (SYN k) :&& (SYN k) infixl 6 | |
| Top | |
| (SYN k) :|| (SYN k) infixl 6 | |
| Zero |
Instances
| (Monoidal k, KnownObj a, a ~ b, KnownCtx g) => BindVarBy 'EQ n (a :: SYN k) ('(m, b) ': g :: [(Nat, SYN k)]) (g :: Ctx k) Source Github # | |
| (Monoidal k, Comonoid (Interp a), KnownObj a, KnownObj b, KnownCtx g) => BindVarBy 'GT n (a :: SYN k) ('(m, b) ': g :: [(Nat, SYN k)]) ('(m, b) ': g :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, Comonoid (Interp a), KnownObj a) => BindVar n (a :: SYN k) ('[] :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # | |
| (KnownCtx r, BindVarBy (CmpNat n m) n a ('(m, b) ': g) r) => BindVar n (a :: SYN k) ('(m, b) ': g :: [(Natural, SYN k)]) (r :: Ctx k) Source Github # | |
| (SymMonoidal k, CocommutativeComonoid (Interp a), KnownObj a, a ~ b, Merge g1 g2, KnownCtx (Union g1 g2)) => MergeBy 'EQ ('(n, a) ': g1 :: [(Nat, SYN k)]) ('(m, b) ': g2 :: [(Nat, SYN k)]) Source Github # | A variable both contexts have is copied, one copy for each side. |
| (SymMonoidal k, Merge g1 ('(m, b) ': g2), KnownObj a, KnownObj b, Mul ('(n, a) ': Union g1 ('(m, b) ': g2)) ~ (Mul (Union g1 ('(m, b) ': g2)) ':** a)) => MergeBy 'GT ('(n, a) ': g1 :: [(Nat, SYN k)]) ('(m, b) ': g2 :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, Merge ('(n, a) ': g1) g2, KnownObj a, KnownObj b, Mul ('(m, b) ': Union ('(n, a) ': g1) g2) ~ (Mul (Union ('(n, a) ': g1) g2) ':** b)) => MergeBy 'LT ('(n, a) ': g1 :: [(Nat, SYN k)]) ('(m, b) ': g2 :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, KnownObj a, a ~ b, Thin g h) => ThinBy 'EQ ('(n, a) ': g :: [(Nat, SYN k)]) ('(m, b) ': h :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, Comonoid (Interp a), KnownObj a, KnownObj b, Thin g ('(m, b) ': h)) => ThinBy 'GT ('(n, a) ': g :: [(Nat, SYN k)]) ('(m, b) ': h :: [(Nat, SYN k)]) Source Github # | |
| (SymMonoidal k, Unmerge g1 ('(m, b) ': g2), KnownObj a, KnownObj b, Mul ('(n, a) ': Union g1 ('(m, b) ': g2)) ~ (Mul (Union g1 ('(m, b) ': g2)) ':** a)) => UnmergeBy 'GT ('(n, a) ': g1 :: [(Nat, SYN k)]) ('(m, b) ': g2 :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, Unmerge ('(n, a) ': g1) g2, KnownObj a, KnownObj b, Mul ('(m, b) ': Union ('(n, a) ': g1) g2) ~ (Mul (Union ('(n, a) ': g1) g2) ':** b)) => UnmergeBy 'LT ('(n, a) ': g1 :: [(Nat, SYN k)]) ('(m, b) ': g2 :: [(Nat, SYN k)]) Source Github # | |
| KnownCtx ('[] :: [(Nat, SYN k)]) Source Github # | |
Defined in Proarrow.Tools.SMC.Internal.Context Methods ctxCase :: (('[] :: [(Nat, SYN k)]) ~ ('[] :: [(Nat, SYN k)]) => r) -> (forall (n :: Nat) (a :: SYN k) (g' :: [(Nat, SYN k)]). (('[] :: [(Nat, SYN k)]) ~ ('(n, a) ': g'), KnownObj a, KnownCtx g') => r) -> r Source Github # withCtxOb :: Monoidal k => (Ob (Interp (Mul ('[] :: [(Nat, SYN k)]))) => r) -> r Source Github # | |
| (Monoidal k, KnownCtx g2) => Merge ('[] :: [(Nat, SYN k)]) (g2 :: Ctx k) Source Github # | |
| (Monoidal k, KnownCtx g2) => Unmerge ('[] :: [(Nat, SYN k)]) (g2 :: Ctx k) Source Github # | |
| Monoidal k => Thin ('[] :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # | |
| (KnownObj a, KnownCtx g) => KnownCtx ('(n, a) ': g :: [(Nat, SYN k)]) Source Github # | |
Defined in Proarrow.Tools.SMC.Internal.Context Methods ctxCase :: (('(n, a) ': g) ~ ('[] :: [(Nat, SYN k)]) => r) -> (forall (n0 :: Nat) (a0 :: SYN k) (g' :: [(Nat, SYN k)]). (('(n, a) ': g) ~ ('(n0, a0) ': g'), KnownObj a0, KnownCtx g') => r) -> r Source Github # withCtxOb :: Monoidal k => (Ob (Interp (Mul ('(n, a) ': g))) => r) -> r Source Github # | |
| (Monoidal k, KnownCtx ('(n, a) ': g1)) => Merge ('(n, a) ': g1 :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, Comonoid (Interp a), KnownObj a, Thin g ('[] :: [(Nat, SYN k)])) => Thin ('(n, a) ': g :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, KnownCtx ('(n, a) ': g1)) => Unmerge ('(n, a) ': g1 :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # | |
| (Monoidal k, KnownObj a, KnownObj b, KnownCtx g1, KnownCtx g2, MergeBy (CmpNat n m) ('(n, a) ': g1) ('(m, b) ': g2)) => Merge ('(n, a) ': g1 :: [(Natural, SYN k)]) ('(m, b) ': g2 :: [(Natural, SYN k)]) Source Github # | |
| (KnownObj a, KnownObj b, KnownCtx g, KnownCtx h, ThinBy (CmpNat n m) ('(n, a) ': g) ('(m, b) ': h)) => Thin ('(n, a) ': g :: [(Natural, SYN k)]) ('(m, b) ': h :: [(Natural, SYN k)]) Source Github # | |
| (Monoidal k, KnownObj a, KnownObj b, KnownCtx g1, KnownCtx g2, UnmergeBy (CmpNat n m) ('(n, a) ': g1) ('(m, b) ': g2)) => Unmerge ('(n, a) ': g1 :: [(Natural, SYN k)]) ('(m, b) ': g2 :: [(Natural, SYN k)]) Source Github # | |
| (Promonad p, KnownObj a) => RecVars k (TermP p d '['(n, a)] a) Source Github # | |
| type Vars k (TermP p d '['(n, a)] a) Source Github # | |
Defined in Proarrow.Tools.SMC.Internal.Do | |
type family Interp (s :: SYN k) :: k where ... Source Github #
The object of k a type expression stands for.
Equations
| Interp ('F a :: SYN k) = a | |
| Interp ('I :: SYN k) = Unit :: k | |
| Interp (a ':** b :: SYN k) = Interp a ** Interp b | |
| Interp (a ':-> b :: SYN k) = Interp a ~~> Interp b | |
| Interp ('Not a :: SYN k) = Dual (Interp a) | |
| Interp ('Dn a :: SYN k) = Interp a | |
| Interp (a ':&& b :: SYN k) = Interp a && Interp b | |
| Interp ('Top :: SYN k) = TerminalObject :: k | |
| Interp (a ':|| b :: SYN k) = Interp a || Interp b | |
| Interp ('Zero :: SYN k) = InitialObject :: k |
class CategoryOf k => KnownObj (s :: SYN k) where Source Github #
Type expressions whose Interp is an object, given that their leaves are.
Instances
| Monoidal k => KnownObj ('I :: SYN k) Source Github # | |
| HasTerminalObject k => KnownObj ('Top :: SYN k) Source Github # | |
| HasInitialObject k => KnownObj ('Zero :: SYN k) Source Github # | |
| KnownObj a => KnownObj ('Dn a :: SYN k) Source Github # | |
| (CategoryOf k, Ob a) => KnownObj ('F a :: SYN k) Source Github # | |
| (Dialogue k, KnownObj a) => KnownObj ('Not a :: SYN k) Source Github # | |
| (HasBinaryProducts k, KnownObj a, KnownObj b) => KnownObj (a ':&& b :: SYN k) Source Github # | |
| (Monoidal k, KnownObj a, KnownObj b) => KnownObj (a ':** b :: SYN k) Source Github # | |
| (Closed k, KnownObj a, KnownObj b) => KnownObj (a ':-> b :: SYN k) Source Github # | |
| (HasBinaryCoproducts k, KnownObj a, KnownObj b) => KnownObj (a ':|| b :: SYN k) Source Github # | |