Haskell MonadReader实例缺失

Haskell MonadReader实例缺失,haskell,typeclass,type-constraints,type-families,Haskell,Typeclass,Type Constraints,Type Families,代码可从以下网址获得: 使用ghc-8编译正常,但使用ghc-7.10编译失败,并出现错误 Test.hs:16:14: Could not deduce (MonadReader (Zipper (Top :>> [Set f]) Int (Set f)) ((->) ((Top :>> [Set f]) :>> Set f))) arising from a use

代码可从以下网址获得:

使用
ghc-8
编译正常,但使用
ghc-7.10
编译失败,并出现错误

Test.hs:16:14:
Could not deduce (MonadReader
                    (Zipper (Top :>> [Set f]) Int (Set f))
                    ((->) ((Top :>> [Set f]) :>> Set f)))
  arising from a use of `view'
from the context (Family f)
  bound by the type signature for
             f :: Family f => (Top :>> [Set f]) :>> Set f -> f (Set f)
  at Test.hs:15:6-57
In the second argument of `(.)', namely `view focus'
In the expression: return . view focus
In an equation for `f': f = return . view focus

在这两种情况下,使用的依赖项完全相同(
mtl 2.2.1
transformers 0.5.2
lens 4.14
zippers 0.2
),除了
base
,对于
ghc-7.10
只能是
4.8
,对于
ghc-8
。我真的不明白为什么它应该用一个编译器而不是另一个编译器来编译。我想让代码也适用于
ghc-7.10

我仍然不知道为什么会出现这个问题。但是在
#haskell
irc频道上的用户
puregreen
的善意帮助下,我能够通过简单地用
(^.focus)
替换
视图焦点来克服这个问题,我仍然不知道为什么会出现这个问题。但是在
#haskell
irc频道上的用户
puregreen
的善意帮助下,我能够通过简单地用
(^.focus)

替换
视图焦点来克服这个问题:
:t帧(未定义的::Conf m)&view focus
在ghci中正确解析为
设置m
。我已将问题简化并将示例移动到。我无法重现此:
:t帧(未定义::Conf m)&view focus
在ghci中正确解析为
设置m
。我已将问题简化并将示例移动到。
Test.hs:16:14:
Could not deduce (MonadReader
                    (Zipper (Top :>> [Set f]) Int (Set f))
                    ((->) ((Top :>> [Set f]) :>> Set f)))
  arising from a use of `view'
from the context (Family f)
  bound by the type signature for
             f :: Family f => (Top :>> [Set f]) :>> Set f -> f (Set f)
  at Test.hs:15:6-57
In the second argument of `(.)', namely `view focus'
In the expression: return . view focus
In an equation for `f': f = return . view focus