This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type 'a term = | |
| Var of 'a | |
| App of 'a term * 'a term | |
let rec pp pp_elt ppf = function | |
| Var x -> pp_elt ppf x | |
| App(f,x) -> | |
Format.fprintf ppf "%a(%a)" (pp pp_elt) f (pp pp_elt) x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type T = sig | |
type t | |
val x: t | |
val show: t -> string | |
end | |
module Int = struct | |
type t = int | |
let x = 1 | |
let show = string_of_int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type void = | | |
module Make(T:sig type 'a t end) = struct | |
type 'a t = | |
| []: void t | |
| (::): 'a T.t * 'b t -> ('a -> 'b) t | |
end | |
module HL = Make(struct type 'a t = 'a end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type 'a s = private Succ | |
type ('elt,'size) t = | |
| [] : ('elt, 'a -> 'a) t | |
| (::): 'elt * ('elt, 'z -> 'k) t -> ('elt, 'z -> 'k s) t | |
let rec (@): type elt low mid high. | |
(elt, mid -> high) t -> (elt, low -> mid) t -> (elt, low -> high) t = | |
fun l r -> | |
match l with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type msg = .. | |
type query_answer = | |
| Accepted | |
| Unknown | |
let printer_registry: (Format.formatter -> msg -> query_answer) list ref = ref [] | |
let register_printer x = printer_registry := x :: !printer_registry | |
let print ppf msg = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type e = .. | |
type e += A | B | C | D | E | F | |
let f = function | |
| A -> 1 | |
| B -> 2 | |
| C -> 3 | |
| D -> 4 | |
| E -> 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = "א" * 100 # "א" is assigned |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type _ data_cstr = .. | |
type 'a data_format = { id: extension_constructor; cstr: 'a data_cstr} | |
type (_, _) eq = Eq : ('a, 'a) eq | |
type data_key = { is_eq: 'a 'b. 'a data_cstr -> 'b data_cstr -> ('a,'b) eq option } | |
let data_format_register : (extension_constructor, data_key) Hashtbl.t = Hashtbl.create 17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type _ data_cstr = .. | |
module type t = sig | |
type a | |
type _ data_cstr += Fmt: a data_cstr | |
end | |
type 'a data_format = (module t with type a = 'a) | |
let mk_data_format : type a. unit -> a data_format = fun () -> |