From 023c11470e32744a43b7e3c7c248f3c47ebdc687 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 21 Nov 2016 17:06:19 +0100 Subject: Use gadt for function catalog --- scTypes.mli | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'scTypes.mli') diff --git a/scTypes.mli b/scTypes.mli index 642ecd2..deef1a0 100755 --- a/scTypes.mli +++ b/scTypes.mli @@ -7,23 +7,22 @@ type cell = (int * int) * (bool * bool) type ident = UTF8.t type types = - | Num : Num.num * (UTF8.t option) -> types (** A number *) - | Str : UTF8.t -> types (** A string *) - | Date : Num.num -> types (** A date in julian day *) + | Num of Num.num * (UTF8.t option) (** A number *) + | Str of UTF8.t (** A string *) + | Date of Num.num (** A date in julian day *) - | Undefined : types (** The content is not defined *) - | Bool : bool -> types (** A boolean *) - | List : types list -> types (** List with heterogenous datas *) + | Undefined (** The content is not defined *) + | Bool of bool (** A boolean *) type refs = - | Cell of cell (** A cell *) - | Range of cell * cell (** An area of cells *) + | Cell of cell (** A cell *) + | Range of cell * cell (** An area of cells *) type expression = - | Value of types (** A direct value *) - | Ref of refs (** A reference to another cell *) - | Call of ident * expression list (** A call to a function *) - | Expression of expression (** An expression *) + | Value of types (** A direct value *) + | Ref of refs (** A reference to another cell *) + | Call of ident * expression list (** A call to a function *) + | Expression of expression (** An expression *) (** Result from a computation *) type result = @@ -40,7 +39,14 @@ end module Refs : sig - val collect: refs -> (int * int) list + type 'a range = + | Single of 'a + | Array1 of 'a list + | Array2 of 'a list list + + val collect: refs -> (int * int) range + + val map: ('a -> 'b) -> 'a range -> 'b range val shift: (int * int) -> refs -> refs -- cgit v1.2.3