summaryrefslogtreecommitdiff
path: root/edit-lens/src/Control
diff options
context:
space:
mode:
Diffstat (limited to 'edit-lens/src/Control')
-rw-r--r--edit-lens/src/Control/Lens/Edit.lhs12
1 files changed, 7 insertions, 5 deletions
diff --git a/edit-lens/src/Control/Lens/Edit.lhs b/edit-lens/src/Control/Lens/Edit.lhs
index 69a6f7f..973f409 100644
--- a/edit-lens/src/Control/Lens/Edit.lhs
+++ b/edit-lens/src/Control/Lens/Edit.lhs
@@ -3,14 +3,16 @@ Dabei werden wir sowohl die Definitionen aus \cite{hofmann2012edit} sowohl in na
3 3
4\begin{code} 4\begin{code}
5{-# LANGUAGE TypeFamilies 5{-# LANGUAGE TypeFamilies
6 , KindSignatures
7 , FlexibleContexts 6 , FlexibleContexts
8 , FlexibleInstances 7 , FlexibleInstances
9 , MultiParamTypeClasses 8 , MultiParamTypeClasses
10 , FunctionalDependencies 9 , FunctionalDependencies
11 , AllowAmbiguousTypes
12 , GADTs
13 #-} 10 #-}
11-- Allow more complicated type families
12{-# LANGUAGE AllowAmbiguousTypes #-}
13-- AmbiguousTypes are useful if we expect functions to be called via TypeApplication
14{-# LANGUAGE GADTs #-}
15-- For allowing constraints on constructors
14 16
15module Control.Lens.Edit 17module Control.Lens.Edit
16 ( Module(..) 18 ( Module(..)
@@ -47,7 +49,7 @@ class Monoid m => Module m where
47 -- prop> m `apply` (e `mappend` e') = (m `apply` e) `apply` e' 49 -- prop> m `apply` (e `mappend` e') = (m `apply` e) `apply` e'
48 init :: Domain m 50 init :: Domain m
49 -- ^ 'init @m' (TypeApplication) is the initial element of 'm' 51 -- ^ 'init @m' (TypeApplication) is the initial element of 'm'
50 divInit :: Domain m -> Del m 52 divInit :: Domain m -> m
51 -- ^ Calculate a representation of an element of 'Domain m' in 'Del m' 53 -- ^ Calculate a representation of an element of 'Domain m' in 'Del m'
52 -- 54 --
53 -- prop> init `apply` divInit m = m 55 -- prop> init `apply` divInit m = m
@@ -131,7 +133,7 @@ class (Module m, Module n) => HasEditLens l m n | l -> m, l -> n where
131 -- ^ Map edits of 'n' to changes of 'm', maintaining some state from 'Complement l' 133 -- ^ Map edits of 'n' to changes of 'm', maintaining some state from 'Complement l'
132 134
133-- | Inspect the components of an edit lens (e.g. 'EditLens') 135-- | Inspect the components of an edit lens (e.g. 'EditLens')
134instance HasEditLens (EditLens c m n) where 136instance (Module m, Module n) => HasEditLens (EditLens c m n) m n where
135 type Complement (EditLens c m n) = c 137 type Complement (EditLens c m n) = c
136 ground (EditLens g _ _) = g 138 ground (EditLens g _ _) = g
137 propR (EditLens _ r _) = r 139 propR (EditLens _ r _) = r