我有这个文件:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ExistentialQuantification #-}
module Toy where
import Control.Lens
data Bar = Bar { _barish :: String }
data Foo = forall a. Show a => Foo { _fooish :: a }
$(makeLenses ''Bar)
$(makeLenses ''Foo)
x = barish
y = fooish
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
Toy.hs:15:5:
Not in scope: `fooish'
Perhaps you meant `_fooish' (line 9)
Run Code Online (Sandbox Code Playgroud)
这是我第一次尝试使用存在量词; 我不知道为什么这些功能组合会中断.更令人担忧的是,为什么我没有收到有关makeLenses失败的错误消息?我跑了runhaskell Toy.hs