syntax-error - SML 错误消息中的 'int ?. tree' 是什么意思?

标签 syntax-error currying smlnj

我为一个类编写了以下 SML 代码:

fun lookup (cmp: 'a * 'a -> order) (x: 'a, t: 'a tree) : 'a option =
    case t of
      Empty => NONE
    | Node(l,y,r) =>
      case cmp(x,y) of
        EQUAL => SOME y
      | LESS => lookup (cmp) (x,r)
      | GREATER => lookup (cmp) (x,l)

在测试中:
val SOME 3 = lookup Int.compare (3, Node(Empty,3,Empty));

并返回以下错误:
stdIn:153.1-166.12 Error: operator and operand don't agree [tycon mismatch]
  operator domain: int * int ?.tree
  operand:         int * int tree
  in expression:
    (lookup Int.compare) (3,Node (Empty,3,Empty))
?. 是什么意思意思是?

最佳答案

这通常与跨模块的可见性受限有关。你的“树”定义是什么样的?您可能需要告诉编译器您在一个模块中的“树”类型与另一个模块中的相同。

关于syntax-error - SML 错误消息中的 'int ?. tree' 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12830731/

相关文章:

list - Currying:追加两个列表

smlnj - 如何使用 SML 模块中的中缀运算符?

oracle - 执行包时出现错误

javascript - 具有两个参数的 Angular 函数具有错误 : [$parse:syntax]

php - 语法错误,意外的 T_VARIABLE

haskell - 如何在 Haskell 中应用偏函数

python - 每当我运行Django程序时,我都会继续收到错误消息

haskell - 我怎么知道我没有完全应用这个 ghc 错误消息中的函数?

sml - 使用 CM.make 编译时未绑定(bind)结构 Int

sml - 标准 ML 中的 elseif 语句?