Types OCaml远期声明

Types OCaml远期声明,types,ocaml,forward-declaration,Types,Ocaml,Forward Declaration,有没有一种方法可以在OCaml中执行C风格的前向声明 我的问题是,我有两个相互引用的变体: type path_formula = [ `Next of state_formula | `Until of (state_formula * state_formula) | `UntilB of (state_formula * int * state_formula) ] type state_formula = [ `True | `False | `N

有没有一种方法可以在OCaml中执行C风格的前向声明

我的问题是,我有两个相互引用的变体:

type path_formula =
  [ `Next of state_formula
  | `Until of (state_formula * state_formula)
  | `UntilB of (state_formula * int * state_formula)  
  ]

type state_formula = 
    [ `True | `False
    | `Not of state_formula
    | `And of (state_formula * state_formula)
    | `Or of (state_formula * state_formula)
    | `Imply of (state_formula * state_formula)
    | `Label of string
    | `Prob` of (boundf * path_formula)
    | `Expc` of (boundi * formula)
    ]
所以这两种类型都必须知道另一种。。我在谷歌上搜索过它,但不幸的是OCaml并不是一种广泛使用的编程语言

type T1 = ...
and T2 = ...

具有递归类型

谢谢,我通常在发现语言特性方面没有问题,但是OCaml与我到目前为止所研究的完全不同,我只能找到数百页的“phat”引用,这让我失去了方向:)注意,你可以掷骰子,搜索F#语法/文档来学习OCaml。核心语法是相同的,因此例如在这里是一个胜利。这是一个很好的观点。我不得不选择OCaml,因为他们强迫我。我认为这是一种古老但功能强大的语言,但如果现代函数式语言(Scala,F#)保持相同的语法,那么这将是一个不错的选择:)OCaml手册是一本不错的读物: