proarrow
Safe HaskellNone
LanguageGHC2024

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.

Synopsis

Documentation

data SYN k Source Github #

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 Dn n is a stored term of n.

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

Instances details
(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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

bindVarBy :: (Interp (Mul g) ** Interp a) ~> Interp (Mul ('(m, b) ': g)) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

bindVarBy :: (Interp (Mul ('(m, b) ': g)) ** Interp a) ~> Interp (Mul ('(m, b) ': g)) Source Github #

(Monoidal k, Comonoid (Interp a), KnownObj a) => BindVar n (a :: SYN k) ('[] :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

bindVar :: (Interp (Mul ('[] :: [(Nat, SYN k)])) ** Interp a) ~> Interp (Mul ('[] :: [(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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

bindVar :: (Interp (Mul r) ** Interp a) ~> Interp (Mul ('(m, b) ': g)) 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.

Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

mergeBy :: Interp (Mul (UnionBy 'EQ ('(n, a) ': g1) ('(m, b) ': g2))) ~> (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) Source Github #

(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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

mergeBy :: Interp (Mul (UnionBy 'GT ('(n, a) ': g1) ('(m, b) ': g2))) ~> (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

mergeBy :: Interp (Mul (UnionBy 'LT ('(n, a) ': g1) ('(m, b) ': g2))) ~> (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

thinBy :: Interp (Mul ('(n, a) ': g)) ~> Interp (Mul ('(m, b) ': h)) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

thinBy :: Interp (Mul ('(n, a) ': g)) ~> Interp (Mul ('(m, b) ': h)) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

unmergeBy :: (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) ~> Interp (Mul (UnionBy 'GT ('(n, a) ': g1) ('(m, b) ': g2))) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

unmergeBy :: (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) ~> Interp (Mul (UnionBy 'LT ('(n, a) ': g1) ('(m, b) ': g2))) Source Github #

KnownCtx ('[] :: [(Nat, SYN k)]) Source Github # 
Instance details

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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

merge :: Interp (Mul (Union ('[] :: [(Nat, SYN k)]) g2)) ~> (Interp (Mul ('[] :: [(Nat, SYN k)])) ** Interp (Mul g2)) Source Github #

(Monoidal k, KnownCtx g2) => Unmerge ('[] :: [(Nat, SYN k)]) (g2 :: Ctx k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

unmerge :: (Interp (Mul ('[] :: [(Nat, SYN k)])) ** Interp (Mul g2)) ~> Interp (Mul (Union ('[] :: [(Nat, SYN k)]) g2)) Source Github #

Monoidal k => Thin ('[] :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

thin :: Interp (Mul ('[] :: [(Nat, SYN k)])) ~> Interp (Mul ('[] :: [(Nat, SYN k)])) Source Github #

(KnownObj a, KnownCtx g) => KnownCtx ('(n, a) ': g :: [(Nat, SYN k)]) Source Github # 
Instance details

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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

merge :: Interp (Mul (Union ('(n, a) ': g1) ('[] :: [(Nat, SYN k)]))) ~> (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('[] :: [(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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

thin :: Interp (Mul ('(n, a) ': g)) ~> Interp (Mul ('[] :: [(Nat, SYN k)])) Source Github #

(Monoidal k, KnownCtx ('(n, a) ': g1)) => Unmerge ('(n, a) ': g1 :: [(Nat, SYN k)]) ('[] :: [(Nat, SYN k)]) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

unmerge :: (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('[] :: [(Nat, SYN k)]))) ~> Interp (Mul (Union ('(n, a) ': g1) ('[] :: [(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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

merge :: Interp (Mul (Union ('(n, a) ': g1) ('(m, b) ': g2))) ~> (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

thin :: Interp (Mul ('(n, a) ': g)) ~> Interp (Mul ('(m, b) ': h)) 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 # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Context

Methods

unmerge :: (Interp (Mul ('(n, a) ': g1)) ** Interp (Mul ('(m, b) ': g2))) ~> Interp (Mul (Union ('(n, a) ': g1) ('(m, b) ': g2))) Source Github #

(Promonad p, KnownObj a) => RecVars k (TermP p d '['(n, a)] a) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Do

Associated Types

type Vars k (TermP p d '['(n, a)] a) 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Do

type Vars k (TermP p d '['(n, a)] a) = '['(n, a)]

Methods

recVars :: TermP p d '['(n, a)] a Source Github #

type Vars k (TermP p d '['(n, a)] a) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Do

type Vars k (TermP p d '['(n, a)] a) = '['(n, a)]

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.

Methods

withSynOb :: (Ob (Interp s) => r) -> r Source Github #

Instances

Instances details
Monoidal k => KnownObj ('I :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('I :: SYN k)) => r) -> r Source Github #

HasTerminalObject k => KnownObj ('Top :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('Top :: SYN k)) => r) -> r Source Github #

HasInitialObject k => KnownObj ('Zero :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('Zero :: SYN k)) => r) -> r Source Github #

KnownObj a => KnownObj ('Dn a :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('Dn a)) => r) -> r Source Github #

(CategoryOf k, Ob a) => KnownObj ('F a :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('F a)) => r) -> r Source Github #

(Dialogue k, KnownObj a) => KnownObj ('Not a :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp ('Not a)) => r) -> r Source Github #

(HasBinaryProducts k, KnownObj a, KnownObj b) => KnownObj (a ':&& b :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp (a ':&& b)) => r) -> r Source Github #

(Monoidal k, KnownObj a, KnownObj b) => KnownObj (a ':** b :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp (a ':** b)) => r) -> r Source Github #

(Closed k, KnownObj a, KnownObj b) => KnownObj (a ':-> b :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp (a ':-> b)) => r) -> r Source Github #

(HasBinaryCoproducts k, KnownObj a, KnownObj b) => KnownObj (a ':|| b :: SYN k) Source Github # 
Instance details

Defined in Proarrow.Tools.SMC.Internal.Syntax

Methods

withSynOb :: (Ob (Interp (a ':|| b)) => r) -> r Source Github #

synOb :: forall {k} (s :: SYN k). KnownObj s => Obj (Interp s) Source Github #

The identity on the object a type expression stands for.