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 Reference,A._
应该被解释为consym (A)
,varsym (.)
和reservedid (_)
,因为_
不是有效varid
(varid
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
。
有人可以帮我解释发生了什么事吗?