Add comments showing CPS and store lens idea
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
b1603f17ce
commit
4d3bc29f81
2 changed files with 29 additions and 0 deletions
|
@ -64,6 +64,24 @@ data Lens s t a b =
|
||||||
Lens
|
Lens
|
||||||
(forall f. Functor f => (a -> f b) -> s -> f t)
|
(forall f. Functor f => (a -> f b) -> s -> f t)
|
||||||
|
|
||||||
|
-- Lens s t a b
|
||||||
|
|
||||||
|
-- Lens u w s t
|
||||||
|
-- (s -> f t) -> w -> f w
|
||||||
|
|
||||||
|
-- Lens u w s t . Lens s t a b
|
||||||
|
|
||||||
|
-- p :: (->)
|
||||||
|
-- p a b
|
||||||
|
|
||||||
|
-- f :: s -> a
|
||||||
|
-- fcps :: forall r . (a -> r) -> s -> r
|
||||||
|
-- f ~ fcps id
|
||||||
|
-- fcps = \c -> c . f
|
||||||
|
-- (a -> r) . s -> a
|
||||||
|
-- forall r . (a -> f r) -> s -> f r
|
||||||
|
-- forall f . Functor f => (a -> f b) -> s -> f t
|
||||||
|
|
||||||
-- Const :: forall b . a -> Const a b
|
-- Const :: forall b . a -> Const a b
|
||||||
get ::
|
get ::
|
||||||
Lens s t a b
|
Lens s t a b
|
||||||
|
|
|
@ -100,6 +100,17 @@ extractS = \(Store sToa s) -> sToa s
|
||||||
|
|
||||||
----
|
----
|
||||||
|
|
||||||
|
-- data Lens a b =
|
||||||
|
-- Lens
|
||||||
|
-- (a -> b -> a)
|
||||||
|
-- (a -> b)
|
||||||
|
-- data Store s a = Store (s -> a) s
|
||||||
|
|
||||||
|
-- a -> Store b a
|
||||||
|
-- a -> Store (b -> a) b
|
||||||
|
-- Drop the Store wrapper
|
||||||
|
-- a -> b -> a
|
||||||
|
-- a -> b
|
||||||
data Lens a b =
|
data Lens a b =
|
||||||
Lens
|
Lens
|
||||||
(a -> Store b a)
|
(a -> Store b a)
|
||||||
|
|
Loading…
Reference in a new issue