This file contains 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 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 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 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 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 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 _ foo = F1: int foo | F2: boo foo | |
type 'b any = Any: 'a foo * ('a,'b) eq -> 'b any | |
let split x = Any(x,Refl) | |
let g (type tmp) (): int = | |
let Any (type t) (foo,secret: t foo * (t,_) eq ) = split F1 in | |
let tmp: t = match foo with F1 -> 0 | F2 -> true in | |
match secret with Refl -> tmp |
This file contains 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 M = Map.Make(struct type t = int let compare = compare end) | |
type _ maps = | |
| Int: int M.t maps | |
| Float: float M.t maps | |
let add_zero_int (w:int M.t maps) = match w with | |
| Int -> 0 | |
| _ -> . |
This file contains 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
(* TEST | |
* bytecode | |
ocamlc_byte_exit_status = "2" | |
*) | |
[@@@warning "@8"] | |
let None = None |
This file contains 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 empty = sig end | |
module Empty = struct end;; | |
module type a | |
module type b | |
module type c | |
module Example_2 = struct | |
module type f = functor (X:a)(Y:b) -> c |