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
let f [%pattern]: [%type_expression] = [%expression] | |
module type s = [%module_type] | |
module M = struct | |
[%%structure_item] | |
include [%module_expression] | |
end | |
module type S = sig [%%signature_item] end | |
class c: int -> [%class_type] = fun x -> [%class_expression] | |
class c: object [%%class_type_field] end = object [%%class_field] 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
type visited = Visited | |
type free = Free | |
type vi = visited | |
type e = | | |
type 'a chess = 'a | |
constraint | |
'a = | |
< | |
ul: _; up: _; ur: _; |
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 x = X | |
type o = O | |
type 'a l = 'a * 'a * 'a | |
type 'a c = 'a * 'a * 'a | |
type 'a s = 'a l c | |
type 't lfirst = 'a * 'b * 'c | |
constraint 't = 'a * ('b * 'c) |
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 | |
flags = "-I ${ocamlsrcdir}/parsing" | |
include ocamlcommon | |
* expect | |
*) | |
let x = Ast_helper.Exp.ident | |
[%%expect{| | |
val 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
module type showable = sig | |
type t | |
val show: t -> string | |
end | |
(** Typeclass emulation *) | |
let show (type a) (module M: showable with type t = a) x = M.show x | |
(** Or with a type abbreviation *) | |
type 'a showable = (module showable with type t = 'a) |
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
opam-version: "2.0" | |
compiler: [ | |
"base-bigarray.base" | |
"base-threads.base" | |
"base-unix.base" | |
"ocaml.4.05.0" | |
"ocaml-base-compiler.4.05.0" | |
"ocaml-config.1" | |
] | |
roots: ["ocaml-base-compiler.4.05.0" "ocsigenserver.2.9"] |
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 |
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 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
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 |