Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Zoom ContT, cleaned up docs

  • Loading branch information...
commit 44578f0529946a09c191137188b8c218ea05b848 1 parent c8b7ae4
@ekmett authored
Showing with 6 additions and 6 deletions.
  1. +1 −1  src/Control/Lens/Getter.hs
  2. +5 −5 src/Control/Lens/Type.hs
View
2  src/Control/Lens/Getter.hs
@@ -358,7 +358,7 @@ class (MonadReader b m, MonadReader a n) => Magnify m n b a | m -> b, n -> a, m
--
-- This acts like 'Control.Monad.Reader.Class.local', but can in many cases change the type of the environment as well.
--
- -- This is commonly used to lift actions in a simpler Reader monad into a state monad with a larger state type.
+ -- This is commonly used to lift actions in a simpler Reader monad into a monad with a larger environment type.
--
-- This can be used to edit pretty much any monad transformer stack with an environment in it:
--
View
10 src/Control/Lens/Type.hs
@@ -116,7 +116,7 @@ import Control.Monad.Trans.Writer.Strict as Strict
import Control.Monad.Trans.RWS.Lazy as Lazy
import Control.Monad.Trans.RWS.Strict as Strict
import Control.Monad.Trans.Reader
--- import Control.Monad.Trans.Cont
+import Control.Monad.Trans.Cont
import Control.Monad.Trans.Error
import Control.Monad.Trans.List
import Control.Monad.Trans.Identity
@@ -417,12 +417,12 @@ instance Zoom m n s t => Zoom (IdentityT m) (IdentityT n) s t where
instance Zoom m n s t => Zoom (MaybeT m) (MaybeT n) s t where
zoom l (MaybeT m) = MaybeT (zoom l m)
-{-
instance Zoom m m a a => Zoom (ContT r m) (ContT r m) a a where
zoom l (ContT m) = ContT $ \k -> do
- IndexedState ba a <- State.gets (l (IndexedState id))
- ...
--}
+ f <- State.state $ \s -> case l (IndexedStore id) s of
+ IndexedStore f t -> (f, t)
+ r <- m k
+ State.state $ \t -> (r, f t)
-------------------------------------------------------------------------------
-- Common Lenses
Please sign in to comment.
Something went wrong with that request. Please try again.