简体   繁体   中英

What does it mean to define a type with no constructors in OCaml?

I saw this OCaml code in the Coq codebase :

type ('a, 'b, 'c) tag

which seems we create the type tag that takes three type arguments 'a, 'b, 'c but has no constructors…? So how do we even construct values for this type?

Because this is in reference to a specification in an interface, this simply means that constructors are not exposed as part of the interface.

However, this does not mean there is no way to obtain a value of this type. In this case, it appears the primary (possibly only; I am unfamiliar with Coq's API) way to obtain a value of this type would be to use get_arg_tag from the containing module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM