【发布时间】:2012-06-21 15:31:44
【问题描述】:
我在考虑 Haskell (GHC) 中的隐式参数时遇到问题。我有一个函数 f,它假定隐式参数 x,并希望通过将 f 应用于 将其封装在上下文中g
f :: (?x :: Int) => Int -> Int
f n = n + ?x
g :: (Int -> Int) -> (Int -> Int)
g t = let ?x = 5 in t
但是当我尝试评估时
g f 10
我收到 x 未绑定的错误,例如:
Unbound implicit parameter (?x::Int)
arising from a use of `f'
In the first argument of `g', namely `f'
In the second argument of `($)', namely `g f 10'
谁能告诉我,我做错了什么?
(我正在尝试让 Haskell 的 WordNet 接口工作 - http://www.umiacs.umd.edu/~hal/HWordNet/ - 它以上述方式用于隐式参数,当我尝试编译它时,我不断收到上述错误)
【问题讨论】:
标签: haskell parameters ghc implicit wordnet