有没有办法告诉Agda一个特定的字符标志着新令牌的开始?例如,我有以下(花式unicode的括号内): data Term where
_(_) : Term -> Term -> Term
,我可以为 f ( e⃗ )
使用,但我真正喜欢的是用它作为 f(e⃗)
如果我这样做,Agda认为它是一个单一的标识符,并给出了一个不在范围内的错误。有没有解决的办法?
为什么不允许在Haskell中作为中缀运算符? GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> :{
infixr 6 〉
(〉) :: Int -> (Int -> (Int))
a 〉 b = a + 2*b
:}
print (1 〉 2)
根据这一Haskell Reportany
我想要做的是使用中缀fmap(我定义为< ^>)为多种类型工作,如Option和Either(自定义类型)。 考虑: type Either<'a, 'b> = Left of 'a | Right of 'b
在代码中,我希望能够做到: let fO (a : int option) = None
let fE (a : Either<string,int>) = Left "du