Jean-Philippe Bernardy & Arnaud Spiwack
(π *** π) >>>
arr (\((x,y),z) -> (x,(y,z))) >>>
(π *** π)
first π >>>
((first π) *** π) >>>
arr (\((x,y),z) -> (x,(y,z))) >>>
π
(π *** π) >>>
arr (\((x,y),z) -> (x,(y,z))) >>>
(π *** π)
first π >>>
((first π) *** π) >>>
arr (\((x,y),z) -> (x,(y,z))) >>>
π
1
2
1
3
2
1
2
1
2
3
class Category k => SymmetricMonoidal k where
(Γ) :: (a `k` b) -> (c `k` d) -> (a β c) `k` (b β d)
π :: (a β b) `k` (b β a)
πΌ :: ((a β b) β c) `k` (a β (b β c))
πΌΒ―ΒΉ :: (a β (b β c)) `k` ((a β b) β c)
π :: a `k` (a β ())
πΒ―ΒΉ :: (a β ()) `k` a
SMC
Arrow
Linear types Β Β Β SMC
let f (a,b) =
let (x,y,z) = π a in
let (t,w) = π (y,b) in
(π (x,t), π (z,w))
in
decode f
A port
π :: (P a, P b) βΈ (P c, P d, P e)
type P :: (Type -> Type -> Type) -> Type -> Type -> Type
unit :: P k r ()
split :: P k r (a β b) βΈ (P k r a, P k r b)
merge :: (P k r a , P k r b) βΈ P k r (a β b)
encode :: (a `k` b) -> (P k r a βΈ P k r b)
decode :: (forall r. P k r a βΈ P k r b) -> (a `k` b)
the category
technical device
must be linear
Ports βliveβ in a syntactic cartesian extension
Linear types ensure that we can eliminate the cartesian syntax
proc (a,b) -> do
(x,y) <- π -< a
z <- π -< b
c <- π -< x
d <- π -< (y,z)
returnA -< (c,d)
\(a,b) ->
let (x,y) = π a in
let z = π b in
let c = π x in
let d = π (y,z) in
(c,d)
Arrow
SMC
https://slides.com/aspiwack/haskell-symposium-2021
https://hackage.haskell.org/package/linear-smc
https://dl.acm.org/doi/10.1145/3471874.3472980