1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
type primitive_type = Unit | Bool | Custom of string * string list

module Make () = Typlib.Types.Make (struct
  type nonrec primitive_type = primitive_type

  let primitive_card = function
    | Unit ->
        1
    | Bool ->
        2
    | Custom (_id, cons) ->
        List.length cons

  let fprintf_primitive_type fmt = function
    | Bool ->
        Format.fprintf fmt "bool"
    | Unit ->
        Format.fprintf fmt "unit"
    | Custom (id, _cons) ->
        Format.fprintf fmt "%s" id
end)