表达式为“A._”的Haskell令牌

时间:2017-08-11 17:46:18

标签: haskell syntax typed-holes

Haskell如何解释表达式A._? 例如。在main = print $ A._

Haskell抛出以下错误错误:

source_file.hs:1:16:
    Found hole ‘_’ with type: r0
    Where: ‘r0’ is an ambiguous type variable
    Relevant bindings include
      main :: IO ()
        (bound at source_file.hs:1:1)
    In the second argument of ‘($)’, namely ‘A._’
    In the expression: print $ A._
    In an equation for ‘main’: main = print $ A._

但是,根据Haskell的Syntax ReferenceA._应该被解释为consym (A)varsym (.)reservedid (_),因为_不是有效varidvarid s不能为reservedid s。。

Haskell为main = print $ A._t抛出相同的错误:

source_file.hs:1:16:
    Found hole ‘_t’ with type: r0
    Where: ‘r0’ is an ambiguous type variable
    Relevant bindings include
      main :: IO ()
        (bound at source_file.hs:1:1)
    In the second argument of ‘($)’, namely ‘A._t’
    In the expression: print $ A._t
    In an equation for ‘main’: main = print $ A._t

但是,在这种情况下,令牌序列应为qvarid (A._t)A匹配modid_t匹配varid

有人可以帮我解释发生了什么事吗?

0 个答案:

没有答案