string (* Constructor with arg*) | Pair of string * int (* Constructor with args *) | Gadt : int -> enum (* GADT constructor *) | Inlined of { x : int } (* Inline record *) Constructed false } r.field2 <- r.field2 + 1; let c = Constant let c = Param "foo" let c = Pair ("bar",3) let c = Gadt
. ---- ev_0 ev 0 ---- ev_SS ev 2 ---- ev_SS ev 4 So we can literally translate them into a GADT: Inductive An “Indexed” GADT and two constructors (Technically) In an Inductive definition, an argument to the type From this perspective, there is an alternative way to write this GADT: Inductive even : nat → Prop := For GADT, i.e.
. (* GADT style, dependent type *) Syntax for arguments having the same type As a notational convenience
* in ADT syntax *) Inductive list (X:Type) : Type := | nil | cons (x : X) (l': list X) (* in GADT
(Recursive Type like ADT/GADT in ML/Haskell is a limited form of recursion allowing no arbitray recursion