谁能告诉为什么这段代码不能编译
data A = A {
_b :: B
}
makeLenses ''A
type B = String
带消息
Not in scope: type constructor or class B
这确实:
type B = String
data A = A {
_b :: B
}
makeLenses ''A
没有
makeLenses
一切都编译得很好。为什么我不能在 makeLenses 之后有类型同义词声明?
最佳答案
范围内只能访问模板 haskell 调用之前的定义。
请参阅有关同一主题的上一个问题:Haskell: Template Haskell and the scope .
关于haskell - 这是 Template Haskell 的预期行为吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30274027/