Is this the expected behavior of a Haskell pattern?

Can someone tell me why this code does not compile

data A = A { _b :: B } makeLenses ''A type B = String 

with message

 Not in scope: type constructor or class B 

and it does:

 type B = String data A = A { _b :: B } makeLenses ''A 

Without makeLenses everything compiles fine.

Why can't I write a synonym declaration after makeLenses?

+6
source share
1 answer

Only definitions are available in the area before the haskell template is called.

See this previous question on the same topic: Haskell: Haskell template and scope .

+8
source

Source: https://habr.com/ru/post/987327/


All Articles