From 4d3bc29f8172ceb9fb5bfb98d6ad800d6b919ce5 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Sun, 22 Mar 2020 19:44:17 +0530 Subject: [PATCH] Add comments showing CPS and store lens idea Signed-off-by: Sanchayan Maity --- src/Lets/OpticPolyLens.hs | 18 ++++++++++++++++++ src/Lets/StoreLens.hs | 11 +++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/Lets/OpticPolyLens.hs b/src/Lets/OpticPolyLens.hs index 43698a2..520cb75 100644 --- a/src/Lets/OpticPolyLens.hs +++ b/src/Lets/OpticPolyLens.hs @@ -64,6 +64,24 @@ data Lens s t a b = Lens (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 get :: Lens s t a b diff --git a/src/Lets/StoreLens.hs b/src/Lets/StoreLens.hs index 4b6e38c..7cc7153 100644 --- a/src/Lets/StoreLens.hs +++ b/src/Lets/StoreLens.hs @@ -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 = Lens (a -> Store b a)