diff options
Diffstat (limited to 'edit-lens/src/Control')
| -rw-r--r-- | edit-lens/src/Control/Edit.lhs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/edit-lens/src/Control/Edit.lhs b/edit-lens/src/Control/Edit.lhs index 7be8db4..19fe336 100644 --- a/edit-lens/src/Control/Edit.lhs +++ b/edit-lens/src/Control/Edit.lhs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | \begin{comment} | 1 | \begin{comment} |
| 2 | \begin{code} | 2 | \begin{code} |
| 3 | module Control.Edit | 3 | module Control.Edit |
| 4 | ( Module(..) | 4 | ( Module(..), apply' |
| 5 | ) where | 5 | ) where |
| 6 | \end{code} | 6 | \end{code} |
| 7 | \end{comment} | 7 | \end{comment} |
| @@ -24,6 +24,8 @@ In Haskell charakterisieren wir Moduln über ihren Monoid, d.h. die Wahl des Mon | |||
| 24 | Eine Repräsentierung als Typklasse bietet sich an: | 24 | Eine Repräsentierung als Typklasse bietet sich an: |
| 25 | 25 | ||
| 26 | \begin{code} | 26 | \begin{code} |
| 27 | infix 5 `apply` | ||
| 28 | |||
| 27 | class Monoid m => Module m where | 29 | class Monoid m => Module m where |
| 28 | type Domain m :: * | 30 | type Domain m :: * |
| 29 | apply :: Domain m -> m -> Maybe (Domain m) | 31 | apply :: Domain m -> m -> Maybe (Domain m) |
| @@ -37,6 +39,10 @@ class Monoid m => Module m where | |||
| 37 | -- ^ Calculate a representation of an element of 'Domain m' in 'Del m' | 39 | -- ^ Calculate a representation of an element of 'Domain m' in 'Del m' |
| 38 | -- | 40 | -- |
| 39 | -- prop> init `apply` divInit m = m | 41 | -- prop> init `apply` divInit m = m |
| 42 | |||
| 43 | infixl 5 `apply'` | ||
| 44 | apply' :: Module m => Maybe (Domain m) -> m -> Maybe (Domain m) | ||
| 45 | apply' md e = flip apply e =<< md | ||
| 40 | \end{code} | 46 | \end{code} |
| 41 | \end{defn} | 47 | \end{defn} |
| 42 | 48 | ||
