相关疑难解决方法(0)

Haskell: Template Haskell and the scope

This code is compiled fine:

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

type Env = Int
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

Error:

Not in scope: type constructor or class `Env'
Run Code Online (Sandbox Code Playgroud)

I just added a single line makeLenses ''None between type declarations.
This means TemplateHaskell code could …

haskell template-haskell haskell-lens

11
推荐指数
1
解决办法
1038
查看次数

标签 统计

haskell ×1

haskell-lens ×1

template-haskell ×1