【发布时间】:2017-08-11 10:50:11
【问题描述】:
我似乎在与 Idris 语法作斗争。
module Test
data Nat = Z | S Nat
Eq Nat where
Z == Z = True
S n1 == S n2 = n1 == n2
_ == _ = False
这抱怨以下错误(v1.1.1):
.\.\Test.idr:5:8: error: expected: "@",
"with", argument expression,
constraint argument,
function right hand side,
implicit function argument,
with pattern
Eq Nat where
^
Type checking .\.\Test.idr
我不明白为什么,我基本上使用了与文档相同的语法。
当我为自定义的非递归类型(例如 Bool)编写 Eq 实现时,它编译得很好。
【问题讨论】:
标签: interface idris recursive-datastructures