Just takes a value and returns a value - No “Side Effects” - Has ref. transparency - No effect on the environment fun f(a) = b <- a + 2 c <- b * 3 return c - 4
System 6 fun f(a) = b <- get() set(a * b) Global States fun f(a) = log(a) return a + 1 Logging fun f(a) = b <- random() return a + b Random Value … while keeping away from pure computation
System 21 Type systems that tracks the maximum number of arguments used fun f(a @ 2) = a + a → Argument “a” can be used up to twice fun g(a @ 3, b @ 2) = f(a) + f(b) + a
22 Type systems that tracks the security level of arguments fun f(a @ public, b @ private) = send(a) → Argument “a” can be sent, while “b” cannot fun f(a @ public, b @ private) = send(b) → Type Error!
24 x1 : σ1 , … xk : σk @ n1 , … nk ⊦ e : τ "We can obtain the value of expression e provided that x1 may be used n1 times, x2 n2 times, and so on." means …
25 Γ @ R ⊦ e1 : σ Δ, x : σ @ S, n ⊦ e2 : τ Γ, Δ @ R × n, S ⊦ (x ← e1 ; e2 ) : τ e2 can be obtained from n copies of x. ...so we need n copies of Γ We can get e1 from context Γ
26 Γ, x : σ, y : σ @ R, n, m ⊦ e2 : τ Γ, z : σ @ R, n + m ⊦ e2 [x, y ↦ z]: τ x + y x : σ @ 1, y : σ @ 1 ⊦ z + z z : σ @ 2 ⊦ Splitting the values within the environment (unlike effect typing)
Γ @ R ⊦ e1 : σ Δ, x : σ @ S, n ⊦ e2 : τ Γ, Δ @ R ×S n, S ⊦ (x ← e1 ; e2 ) : τ compose Γ, x : σ, y : σ @ R, n, m ⊦ e2 : τ Γ, z : σ @ R, n +S m ⊦ e2 [x, y ↦ z]: τ split x : τ @ 1S ⊦ x : τ Variable Γ , x : σ @ R, 0S ⊦ e : τ Ignore Γ @ R ⊦ e : τ Γ, x : σ @ R, n ⊦ e : τ Max bound n ≦S m Γ, x : σ @ R, m ⊦ e : τ
“Duality” 40 (Exponential-) Graded Comonad B W(A) W(B) C C W(A) Comonad W Γ @ R ⊦ e1 : σ Δ, x : σ @ S, n ⊦ e2 : τ Γ, Δ @ R ×S n, S ⊦ (x ← e1 ; e2 ) : τ coeffect composition
A. “Coeffects: Unified Static Analysis of Context- Dependence”. ICALP 2013. Petricek, T., Orchard, D., & Mycroft, A. “Coeffects: a calculus of context-dependent computation”. ACM SIGPLAN Notices, Vol. 49. Gaboardi, M., Katsumata, S., Orchard, D., Breuvart, F., & Uustalu, T. “Combining effects and coeffects via grading”. ICFP 2016. Sanada, T. “Category-Graded Algebraic Theories and Effect Handlers”. Electronic Notes in Theoretical Informatics and Computer Science, Vol. 1 (February 2023). DOI: 10.46298/entics.10491. Fukihara, Y., & Katsumata, S. "Generalized Bounded Linear Logic and its Categorical Semantics". FOSSACS 2021