Haskell: Template Haskell and the scope

Viewed 1343

This code is compiled fine:

data None = None { _f :: Int }
type Simpl = Env

type Env = Int

However, I got an error with this code:

{-# LANGUAGE TemplateHaskell #-}
import Control.Lens

data None = None { _f :: Int }

type Simpl = Env

makeLenses ''None

type Env = Int

Error:

Not in scope: type constructor or class `Env'

I just added a single line makeLenses ''None between type declarations.
This means TemplateHaskell code could change the scope of type constructor?

Does anyone know the detail about this issue(or how to avoid this problem)?

1 Answers
Related