shithub: martian9

ref: 284f87648016e19394d52aca2505ef24b50bdbca
dir: /types.ml/

View raw version
module rec Types : sig
  type 'a with_meta = { value : 'a; meta : t }

  and t =
    | List of t list with_meta
    | Bool of bool
    | Char of char
    | Nil
    | Comment
    | Pair of t * t
    | Proc of (t list -> t) with_meta
    | Symbol of string with_meta
    | Bytevector of t list
    | Eof_object
    | Number of int (* needs to handle more than one type *)
    | Port of bool (* not sure how to represent this *)
    | String of string
    | Vector of t list with_meta
    | Record of t with_meta
end =
  Types

and Value : sig
  type t = Types.t

  val compare : t -> t -> int
end = struct
  type t = Types.t

  let compare = Stdlib.compare
end

type m9type = Value.t

let list x = Types.List { Types.value = x; meta = Types.Nil }

let proc x = Types.Proc { Types.value = x; meta = Types.Nil }

let symbol x = Types.Symbol { Types.value = x; meta = Types.Nil }

let vector x = Types.Vector { Types.value = x; meta = Types.Nil }

let record x = Types.Record { Types.value = x; meta = Types.Nil }