data Foo = Foo {
_bar :: Map String Integer
} deriving (Eq, Ord, Read, Show, Data, Typeable)
$(deriveSafeCopy 0 'base 'Foo)
$(makeLenses ''Foo)
鉴于上面的代码,我的印象是应该可以做到这一点:
addEntry :: String -> Update Foo ()
addEntry s = zoom bar $ modify $ insert s 0
但 GHC 会抱怨如下:
src/Backend.hs:39:20:
No instance for (Functor
(Control.Lens.Internal.Zoom.Zoomed (Update Foo) ()))
有任何想法吗?