diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2017-10-31 16:07:04 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2017-10-31 16:07:04 +0100 |
commit | ab721136f50914a21f6cca89f0fcfb055ba58cd2 (patch) | |
tree | 60f788e3e8733a6d3606e801bc21a24e419e070e /scTypes.mli | |
parent | db627ca2cfc745bbf2e489251e64054ab2b3bff9 (diff) | |
parent | d8ed0babfa1c03c8f1968443a465972bb3bf460c (diff) |
Update ScTypes.types with types used in evaluator
Diffstat (limited to 'scTypes.mli')
-rwxr-xr-x | scTypes.mli | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/scTypes.mli b/scTypes.mli index 1d8fe54..17b51eb 100755 --- a/scTypes.mli +++ b/scTypes.mli @@ -6,32 +6,70 @@ type cell = (int * int) * (bool * bool) type ident = UTF8.t
-type types =
- | Num of Num.num * (UTF8.t option) (** A number *)
- | Str of UTF8.t (** A string *)
- | Date of Num.num (** A date in julian day *)
- | Bool of bool (** A boolean *)
+type 'a number_format = (float -> 'a, Format.formatter, unit) format
+
+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 result, there is only one representation *)
+ | Bool: DataType.Bool.t dataFormat (* Boolean result *)
+
+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 =
+ | 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 *)
+
+type typeContainer =
+ | Value: 'a types -> typeContainer
+
+
+(** 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 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 : '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 of types
- | Error of exn
+ | Result : 'a types -> result
+ | Error : exn -> result
module Type : sig
- val (=) : types -> types -> bool
+ val (=) : 'a types -> 'b types -> bool
- val show: UTF8.Buffer.buffer -> types -> unit
+ val show: UTF8.Buffer.buffer -> 'a types -> unit
end
|