これは、モジュールについてよりよく理解するために私が書いた単純なプログラムです。toS
で関数を呼び出そうとしていますId("a",Int)
が、このように ast 型を書けるようです。何が問題なのですか?
module Typ =
struct
type typ = Int | Bool
end
module Symbol =
struct
type t = string
end
module Ast =
struct
type ast = Const of int * Typ.typ | Id of Symbol.t * Typ.typ
let rec toS ast = match ast with Id(a,b) -> "a"
|_->"b"
end
Ast.toS Id("a",Int)