|
|
[ Trac ticket](https://gitlab.haskell.org/ghc/ghc/issues/9596)
|
|
|
[Trac ticket](https://gitlab.haskell.org/ghc/ghc/issues/9596)
|
|
|
|
|
|
[ Phabricator differential](https://phabricator.haskell.org/D212)
|
|
|
[Phabricator differential](https://phabricator.haskell.org/D212)
|
|
|
|
|
|
## Design of the monoidal category classes and the new Arrow/proc desugaring story
|
|
|
|
|
|
### What are monoidal categories and why are they useful?
|
|
|
|
|
|
|
|
|
Monoidal (and related) categories capture the basic notion of *process*. This is most easily noticed by recognising a tool for using monoidal categories called [ string diagrams](http://ncatlab.org/nlab/show/string+diagram). Examples of string diagrams include circuit diagrams, flow charts, signal flow diagrams, Feynman diagrams, proof nets, etc. In that way, monoidal categories are like Arrows (indeed, every Arrow is a monoidal category with an additional structure which allows reification of functions, and application of one input to another) - except much more general. For example, Megacz's work on Generalized Arrows can be entirely subsumed by monoidal categories (indeed, I even based the initial design off of parts of his thesis)
|
|
|
Monoidal (and related) categories capture the basic notion of *process*. This is most easily noticed by recognising a tool for using monoidal categories called [string diagrams](http://ncatlab.org/nlab/show/string+diagram). Examples of string diagrams include circuit diagrams, flow charts, signal flow diagrams, Feynman diagrams, proof nets, etc. In that way, monoidal categories are like Arrows (indeed, every Arrow is a monoidal category with an additional structure which allows reification of functions, and application of one input to another) - except much more general. For example, Megacz's work on Generalized Arrows can be entirely subsumed by monoidal categories (indeed, I even based the initial design off of parts of his thesis)
|
|
|
|
|
|
### Overview
|
|
|
|
|
|
|
|
|
The new class hierarchy is based on monoidal categories, and monoidal categories with additional structure. What is a monoidal category? [ From ncatlab:](http://ncatlab.org/nlab/show/monoidal+category)
|
|
|
The new class hierarchy is based on monoidal categories, and monoidal categories with additional structure. What is a monoidal category? [From ncatlab:](http://ncatlab.org/nlab/show/monoidal+category)
|
|
|
|
|
|
<table><tr><th>Definition</th>
|
|
|
<th>Explaination
|
... | ... | @@ -41,7 +41,7 @@ It also obeys two laws known as the Pentagon equation and the Triangle equation. |
|
|
1. Write monoidal category class heirarchy in GHC.Arrows.Experimental and provide instances for Arrow and several other basic types, and visa versa; make SMC instances for Arrows
|
|
|
1. Convert or write a small FRP library to be based on the new classes to test the design
|
|
|
1. Provide optimisation RULES pragmas as much as possible; for example, the work on Causal Commutative Arrows can be converted relatively straightforwardly to plain monoidal categories
|
|
|
1. Convert the proc/arrow desugarer in GHC to emit instances of the new classes; since all Arrows are monoidal categories, this change will be backwards compatible with user code - use [ https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf](https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf)
|
|
|
1. Convert the proc/arrow desugarer in GHC to emit instances of the new classes; since all Arrows are monoidal categories, this change will be backwards compatible with user code - use [https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf](https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf)
|
|
|
1. Change GHC.Arrows.Experimental to GHC.MonoidalCats before the milestone it is merged for
|
|
|
|
|
|
|
... | ... | @@ -97,4 +97,4 @@ Current (arrows): |
|
|
```
|
|
|
|
|
|
|
|
|
New (SMC) (wip, these need to be as generalised as possible; look at GA thesis and [ https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf](https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf)): |
|
|
New (SMC) (wip, these need to be as generalised as possible; look at GA thesis and [https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf](https://www.haskell.org/ghc/docs/papers/arrow-rules.pdf)): |