diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-11-24 17:38:54 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-11-24 17:38:54 +0100 |
| commit | afc34d76c845f1be96818addcffb4f70d9d2ea9d (patch) | |
| tree | 8e5d9180cc5986e219e5d776bf7bae37913fbf9d /edit-lens/src/Control/Lens/Edit | |
| parent | b9db9f8d7f3eb993ed345357c428a94c9a208c5b (diff) | |
| download | incremental-dfsts-afc34d76c845f1be96818addcffb4f70d9d2ea9d.tar incremental-dfsts-afc34d76c845f1be96818addcffb4f70d9d2ea9d.tar.gz incremental-dfsts-afc34d76c845f1be96818addcffb4f70d9d2ea9d.tar.bz2 incremental-dfsts-afc34d76c845f1be96818addcffb4f70d9d2ea9d.tar.xz incremental-dfsts-afc34d76c845f1be96818addcffb4f70d9d2ea9d.zip | |
Work on containers
Diffstat (limited to 'edit-lens/src/Control/Lens/Edit')
| -rw-r--r-- | edit-lens/src/Control/Lens/Edit/Generic.lhs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/edit-lens/src/Control/Lens/Edit/Generic.lhs b/edit-lens/src/Control/Lens/Edit/Generic.lhs new file mode 100644 index 0000000..9dd1b78 --- /dev/null +++ b/edit-lens/src/Control/Lens/Edit/Generic.lhs | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | \begin{comment} | ||
| 2 | \begin{code} | ||
| 3 | module Control.Lens.Edit.Generic | ||
| 4 | ( idEL, compEL | ||
| 5 | ) where | ||
| 6 | |||
| 7 | import Control.Edit | ||
| 8 | import Control.Lens.Edit | ||
| 9 | |||
| 10 | import Control.Lens | ||
| 11 | \end{code} | ||
| 12 | \end{comment} | ||
| 13 | |||
| 14 | Wir übernehmen einige der in \cite{hofmann2012edit} vorgestellten Konstruktionen für generische edit-lenses. | ||
| 15 | |||
| 16 | Zunächst bilden edit-lenses die Morphismen einer Kategorie vermöge folgender Konstruktionen: | ||
| 17 | |||
| 18 | \begin{defn}[Identität von edit-lenses] | ||
| 19 | Blub % TODO | ||
| 20 | \begin{code} | ||
| 21 | idEL :: EditLens () a a | ||
| 22 | idEL = EditLens () (over _2 id) (over _2 id) | ||
| 23 | \end{code} | ||
| 24 | \end{defn} | ||
| 25 | |||
| 26 | \begin{defn}[Komposition von edit-lenses] | ||
| 27 | Blub % TODO | ||
| 28 | \begin{code} | ||
| 29 | compEL :: EditLens c b c -> EditLens c' a b -> EditLens (c, c') a c | ||
| 30 | compEL (EditLens c1 bc cb) (EditLens c2 ab ba) = EditLens (c1, c2) ac ca | ||
| 31 | where | ||
| 32 | ac ((c1, c2), a) = ((c1', c2'), c) | ||
| 33 | where (c2', b) = ab (c2, a) | ||
| 34 | (c1', c) = bc (c1, b) | ||
| 35 | ca ((c1, c2), c) = ((c1', c2'), a) | ||
| 36 | where (c2', a) = ba (c2, b) | ||
| 37 | (c1', b) = cb (c1, c) | ||
| 38 | \end{code} | ||
| 39 | \end{defn} | ||
| 40 | |||
| 41 | Es ist leider nicht möglich eine Instanz für die Kategorien-Typeklasse der Haskell-Standardlibrary \cite[\texttt{Control.Category}]{base} zu definieren, da sich die Typklasse \texttt{Category} auf Typen vom Kind $\ast \to \ast \to \ast$ einschränkt, \texttt{EditLens} jedoch notwendigerweise den Typ seines Komplements mit sich trägt. | ||
