Extending an existing type in OCaml

后端 未结 4 966
栀梦
栀梦 2020-12-10 01:43

I\'ve been doing some OCaml programming lately to learn the language and to get more acquainted with functional programming. Recently, I\'ve started to think that I\'d like

4条回答
  •  -上瘾入骨i
    2020-12-10 02:21

    Update: Ocaml now has extensible types. http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec246

    Here you would do

    type bexpr += Nop of bexpr
    

提交回复
热议问题