1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
\DOC get_type_arity
\TYPE {get_type_arity : string -> int}
\SYNOPSIS
Returns the arity of a type constructor.
\DESCRIBE
When applied to the name of a type constructor, {arity} returns its arity, i.e.
how many types it is supposed to be applied to. Base types like {:bool} are
regarded as constructors with zero arity.
\FAILURE
Fails if there is no type constructor of that name.
\EXAMPLE
{
# get_type_arity "bool";;
val it : int = 0
# get_type_arity "fun";;
val it : int = 2
# get_type_arity "nocon";;
Exception: Failure "find".
}
\SEEALSO
new_type, new_type_definition, types.
\ENDDOC
|