data Foo = Foo {
_bar :: Map String Integer
} deriving (Eq, Ord, Read, Show, Data, Typeable)
$(deriveSafeCopy 0 'base 'Foo)
$(makeLenses ''Foo)
Given the above code I am under the impression that it should be possible to do this:
addEntry :: String -> Update Foo ()
addEntry s = zoom bar $ modify $ insert s 0
But GHC will complain along the lines of:
src/Backend.hs:39:20:
No instance for (Functor
(Control.Lens.Internal.Zoom.Zoomed (Update Foo) ()))
Any ideas?
Control.Lens.Internal.Zoom.Zoomedis a type family which describes what kind of context is required during azoom. It performs some special magic as you can see in theControl.Lens.Internal.Zoommodule. Typically a user ofzoomwould never need to see that stuff so long as they zoom in on a "typical" monad transformer stack.Update, while being implemented as justStatebeneath the covers, doesn't have a zoom instance. Its implementation is not exported either so you're unable to write your own, though it'd be quite trivial sinceUpdatedoesn't use monad transformers.