(** All the types used in the spreadsheet. *) exception Error type cell = (int * int) * (bool * bool) type ident = UTF8.t type 'a dataFormat = | Date: DataType.Num.t dataFormat (* A date in julian day *) | Number: DataType.Num.t dataFormat (* Number *) | String: DataType.String.t dataFormat (* String *) | Bool: DataType.Bool.t dataFormat (* Boolean *) type 'a returnType = | Num : DataType.Num.t dataFormat option -> DataType.Num.t returnType (** A number *) | Str : DataType.String.t returnType (** A string *) | Bool : DataType.Bool.t returnType (** A boolean *) type numericType = | Date | Number val get_numeric_type: DataType.Num.t dataFormat -> numericType type 'a types = private | Num : DataType.Num.t dataFormat * DataType.Num.t -> DataType.Num.t types (** A number *) | Str : DataType.String.t -> DataType.String.t types (** A string *) | Bool : DataType.Bool.t -> DataType.Bool.t types (** A boolean *) val number: DataType.Num.t -> DataType.Num.t types val string: DataType.String.t -> DataType.String.t types val boolean: DataType.Bool.t -> DataType.Bool.t types val date: DataType.Num.t -> DataType.Num.t types (** Numeric (any format) *) val f_num: DataType.Num.t returnType (** Date *) val f_date: DataType.Num.t returnType (** Number *) val f_number: DataType.Num.t returnType (** Boolean result *) val f_bool: DataType.Bool.t returnType (** String *) val f_string: DataType.String.t returnType type refs = | Cell of cell (** A cell *) | Range of cell * cell (** An area of cells *) (** This is the cell content *) type expression = | Value : 'a types -> expression (** A direct value *) | Ref : refs -> expression (** A reference to another cell *) | Call : ident * expression list -> expression (** A call to a function *) | Expression : expression -> expression (** An expression *) (** Result from a computation *) type result = | Result : 'a types -> result | Error : exn -> result module Type : sig type t = Value: 'a dataFormat * 'a -> t val (=) : 'a types -> 'b types -> bool val show: UTF8.Buffer.buffer -> 'a types -> unit end module Refs : sig 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 type 'a content = | Value: 'a dataFormat * 'a -> 'a content | List: 'a dataFormat * 'a list -> 'a list content | Matrix: 'a dataFormat * 'a list list -> 'a list list content type refContent = | C: 'a content -> refContent [@@unboxed] (** extract the content from a range. May raise Errors.TypeError if the range cannot be unified. *) val get_content : result option range -> refContent end val show_expr: UTF8.Buffer.buffer -> expression -> unit module Result : sig val (=) : result -> result -> bool val show: result -> UTF8.t end