Can anyone tell why this code doesn't compile
data A = A {
_b :: B
}
makeLenses ''A
type B = String
with message
Not in scope: type constructor or class B
and this does:
type B = String
data A = A {
_b :: B
}
makeLenses ''A
Without makeLenses
everything compiles fine.
Why can't I have type synonim declaration after makeLenses?
Only the definitions before the template haskell call are accessible in the scope.
See this previous question on the same topic: Haskell: Template Haskell and the scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With