X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=matita%2Fcontribs%2Fassembly%2Ffreescale%2Ffreescale_ocaml%2Fmatita_datatypes_constructors.ml;fp=matita%2Fcontribs%2Fassembly%2Ffreescale%2Ffreescale_ocaml%2Fmatita_datatypes_constructors.ml;h=ff2e7cd218c4275a198ffd12b4f3fa0794474c66;hp=0000000000000000000000000000000000000000;hb=f61af501fb4608cc4fb062a0864c774e677f0d76;hpb=58ae1809c352e71e7b5530dc41e2bfc834e1aef1 diff --git a/matita/contribs/assembly/freescale/freescale_ocaml/matita_datatypes_constructors.ml b/matita/contribs/assembly/freescale/freescale_ocaml/matita_datatypes_constructors.ml new file mode 100644 index 000000000..ff2e7cd21 --- /dev/null +++ b/matita/contribs/assembly/freescale/freescale_ocaml/matita_datatypes_constructors.ml @@ -0,0 +1,103 @@ +type void = unit (* empty type *) +;; + +let void_rec = +(function v -> assert false) +;; + +let void_rect = +(function v -> assert false) +;; + +type unit = +Something +;; + +let unit_rec = +(function p -> (function u -> +(match u with + Something -> p) +)) +;; + +let unit_rect = +(function p -> (function u -> +(match u with + Something -> p) +)) +;; + +type ('a,'b) prod = +Pair of 'a * 'b +;; + +let prod_rec = +(function f -> (function p -> +(match p with + Pair(t,t1) -> (f t t1)) +)) +;; + +let prod_rect = +(function f -> (function p -> +(match p with + Pair(t,t1) -> (f t t1)) +)) +;; + +let fst = +(function p -> +(match p with + Pair(a,b) -> a) +) +;; + +let snd = +(function p -> +(match p with + Pair(a,b) -> b) +) +;; + +type ('a,'b) sum = +Inl of 'a + | Inr of 'b +;; + +let sum_rec = +(function f -> (function f1 -> (function s -> +(match s with + Inl(t) -> (f t) + | Inr(t) -> (f1 t)) +))) +;; + +let sum_rect = +(function f -> (function f1 -> (function s -> +(match s with + Inl(t) -> (f t) + | Inr(t) -> (f1 t)) +))) +;; + +type ('a) option = +None + | Some of 'a +;; + +let option_rec = +(function p -> (function f -> (function o -> +(match o with + None -> p + | Some(t) -> (f t)) +))) +;; + +let option_rect = +(function p -> (function f -> (function o -> +(match o with + None -> p + | Some(t) -> (f t)) +))) +;; +