text
stringlengths
0
601k
module N1 = struct type u = v and v = M1 . v end ; ;
module N2 = struct type u = v and v = M1 . v end ; ;
module type PR6566 = sig type t = string end ; ;
module PR6566 = struct type t = int end ; ;
module PR6566 ' : PR6566 = PR6566 ; ;
module A = struct module B = struct type t = T end end ; ;
module M2 = struct type u = A . B . t type foo = int type v = A . B . t end ; ;
module type VALUE = sig type value type state type usert end ; ;
module type CORE0 = sig module V : VALUE val setglobal : V . state -> string -> V . value -> unit end ; ;
module type CORE = sig include CORE0 val apply : V . value -> V . state -> V . value list -> V . value end ; ;
module type AST = sig module Value : VALUE type chunk type program val get_value : chunk -> Value . value end ; ;
module type EVALUATOR = sig module Value : VALUE module Ast : ( AST with module Value := Value ) type state = Value . state type value = Value . value exception Error of string val compile : Ast . program -> string include CORE0 with module V := Value end ; ;
module type PARSER = sig type chunk val parse : string -> chunk end ; ;
module type INTERP = sig include EVALUATOR module Parser : PARSER with type chunk = Ast . chunk val dostring : state -> string -> value list val mk : unit -> state end ; ;
module type USERTYPE = sig type t val eq : t -> t -> bool val to_string : t -> string end ; ;
module type TYPEVIEW = sig type combined type t val map : ( combined -> t ) * ( t -> combined ) end ; ;
module type COMBINED_COMMON = sig module T : sig type t end module TV1 : TYPEVIEW with type combined := T . t module TV2 : TYPEVIEW with type combined := T . t end ; ;
module type COMBINED_TYPE = sig module T : USERTYPE include COMBINED_COMMON with module T := T end ; ;
module type BARECODE = sig type state val init : state -> unit end ; ;
module USERCODE ( X : TYPEVIEW ) = struct module type F = functor ( C : CORE with type V . usert = X . combined ) -> BARECODE with type state := C . V . state end ; ;
module Weapon = struct type t end ; ;
module type WEAPON_LIB = sig type t = Weapon . t module T : USERTYPE with type t = t module Make : functor ( TV : TYPEVIEW with type t = t ) -> USERCODE ( TV ) . F end ; ;
module type X = functor ( X : CORE ) -> BARECODE ; ;
module type X = functor ( _ : CORE ) -> BARECODE ; ;
module M = struct type t = int * ( < m : ' a > as ' a ) end ; ;
module type S = sig module M : sig type t end end with module M = M ; ;
module type Printable = sig type t val print : Format . formatter -> t -> unit end ; ;
module type Comparable = sig type t val compare : t -> t -> int end ; ;
module type PrintableComparable = sig include Printable include Comparable with type t = t
module type PrintableComparable = sig type t include Printable with type t := t include Comparable with type t := t end ; ;
module type PrintableComparable = sig include Printable include Comparable with type t := t end ; ;
module type ComparableInt = Comparable with type t := int ; ;
module type S = sig type t val f : t -> t end ; ;
module type S ' = S with type t := int ; ;
module type S = sig type ' a t val map : ( ' a -> ' b ) -> ' a t -> ' b t end ; ;
module type S1 = S with type ' a t := ' a list ; ;
module type S2 = sig type ' a dict = ( string * ' a ) list include S with type ' a t := ' a dict end ; ;
module type S = sig module T : sig type exp type arg end val f : T . exp -> T . arg end ; ;
module M = struct type exp = string type arg = int end ; ;
module type S ' = S with module T := M ; ;
module type S = sig type ' a t end with type ' a t := unit ; ;
let property ( type t ) ( ) = let module M = struct exception E of t end in ( fun x -> M . E x ) , ( function M . E x -> Some x | _ -> None ) ; ;
let ( ) = let ( int_inj , int_proj ) = property ( ) in let ( string_inj , string_proj ) = property ( ) in let i = int_inj 3 in let s = string_inj " abc " in Printf . printf " % B \ n " %! ( int_proj i = None ) ; Printf . printf " % B \ n " %! ( int_proj s = None ) ; Printf . printf " % B \ n " %! ( string_proj i = None...
let sort_uniq ( type s ) cmp l = let module S = Set . Make ( struct type t = s let compare = cmp end ) in S . elements ( List . fold_right S . add l S . empty ) ; ;
let ( ) = print_endline ( String . concat " , " ( sort_uniq compare [ " abc " ; " xyz " ; " abc " ] ) ) ; ;
let f x ( type a ) ( y : a ) = ( x = y ) ; ; method m : ' a -> ' a = fun x -> x method n : ' a -> ' a = fun ( type g ) ( x : g ) -> self # m x
type t = private int
module M : sig external a : int -> ( int [ @ untagged ] ) = " a " " a_nat " external b : ( int [ @ untagged ] ) -> int = " b " " b_nat " external a : int -> ( int [ @ untagged ] ) = " a " " a_nat " external b : ( int [ @ untagged ] ) -> int = " b " " b_nat " end ; ;
module Global_attributes = struct [ @@@ ocaml . warning " - 3 " ] external a : float -> float = " a " " noalloc " " a_nat " " float " external b : float -> float = " b " " noalloc " " b_nat " external c : float -> float = " c " " c_nat " " float " external d : float -> float = " d " " noalloc " external e : float -> fl...
module Old_style_warning = struct [ @@@ ocaml . warning " + 3 " ] external a : float -> float = " a " " noalloc " " a_nat " " float " external b : float -> float = " b " " noalloc " " b_nat " external c : float -> float = " c " " c_nat " " float " external d : float -> float = " d " " noalloc " external e : float -> fl...
module Bad1 : sig external f : int -> int = " f " " f_nat " external f : int -> ( int [ @ untagged ] ) = " f " " f_nat " end ; ;
module Bad2 : sig external f : int -> int = " a " " a_nat " external f : ( int [ @ untagged ] ) -> int = " f " " f_nat " end ; ;
module Bad3 : sig external f : float -> float = " f " " f_nat " external f : float -> ( float [ @ unboxed ] ) = " f " " f_nat " end ; ;
module Bad4 : sig external f : float -> float = " a " " a_nat " external f : ( float [ @ unboxed ] ) -> float = " f " " f_nat " end ; ;
module Bad5 : sig external f : int -> ( int [ @ untagged ] ) = " f " " f_nat " external f : int -> int = " f " " f_nat " end ; ;
module Bad6 : sig external f : ( int [ @ untagged ] ) -> int = " f " " f_nat " external f : int -> int = " a " " a_nat " end ; ;
module Bad7 : sig external f : float -> ( float [ @ unboxed ] ) = " f " " f_nat " external f : float -> float = " f " " f_nat " end ; ;
module Bad8 : sig external f : ( float [ @ unboxed ] ) -> float = " f " " f_nat " external f : float -> float = " a " " a_nat " end ; ;
let _ = ignore ( ) ; ; +
let _ = raise Exit 3 ; ;
module PR7135 = struct module M : sig type t = private int end = struct type t = int end include M let lift2 ( f : int -> int -> int ) ( x : t ) ( y : t ) = f ( x :> int ) ( y :> int ) end ; ;
module Test1 = struct type t = private int let f x = let y = if true then x else ( x : t ) in ( y :> int ) end ; ;
let f = function None , None -> 1 | Some _ , Some _ -> 2 ; ;
type _ t = A : int t | B : bool t | C : char t | D : float t
type ( _ , _ , _ , _ ) u = U : ( int , int , int , int ) u
type v = E | F | G ; ;
let f : type a b c d e f g . a t * b t * c t * d t * e t * f t * g t * v * ( a , b , c , d ) u * ( e , f , g , g ) u -> int = function A , A , A , A , A , A , A , _ , U , U -> 1 | _ , _ , _ , _ , _ , _ , _ , G , _ , _ -> 1 ; ;
let f ( x : int t ) = match x with A -> 1 | _ -> 2 ; ;
let f ( x : unit t option ) = match x with None -> 1 | _ -> 2 ; ;
let f ( x : unit t option ) = match x with None -> 1 | Some _ -> 2 ; ;
let f ( x : int t option ) = match x with None -> 1 | _ -> 2 ; ;
let f ( x : int t option ) = match x with None -> 1 ; ;
type ' a box = Box of ' a
type ' a pair = { left : ' a ; right : ' a } ; ;
let f : ( int t box pair * bool ) option -> unit = function None -> ( ) ; ;
let f : ( string t box pair * bool ) option -> unit = function None -> ( ) ; ;
type _ t = | Int : int t | Bool : bool t ; ;
let f : type a . a t -> a = function | Int -> 1 | Bool -> true ; ;
let g : int t -> int = function | Int -> 1 ; ;
let h : type a . a t -> a t -> bool = fun x y -> match x , y with | Int , Int -> true | Bool , Bool -> true ; ;
type ( _ , _ ) cmp = | Eq : ( ' a , ' a ) cmp | Any : ( ' a , ' b ) cmp
module A : sig type a type b val eq : ( a , b ) cmp end = struct type a type b = a let eq = Eq end ; ;
let f : ( A . a , A . b ) cmp -> unit = function Any -> ( ) ; ;
let deep : char t option -> char = function None -> ' c ' ; ;
type _ succ = Succ ; ;
type ( _ , _ , _ ) plus = | Plus0 : ( zero , ' a , ' a ) plus | PlusS : ( ' a , ' b , ' c ) plus -> ( ' a succ , ' b , ' c succ ) plus ; ;
let trivial : ( zero succ , zero , zero ) plus option -> bool = function None -> false ; ;
let easy : ( zero , zero succ , zero ) plus option -> bool = function None -> false ; ;
let harder : ( zero succ , zero succ , zero succ ) plus option -> bool = function None -> false ; ;
let harder : ( zero succ , zero succ , zero succ ) plus option -> bool = function None -> false | Some ( PlusS _ ) -> . ; ;
let inv_zero : type a b c d . ( a , b , c ) plus -> ( c , d , zero ) plus -> bool = fun p1 p2 -> match p1 , p2 with | Plus0 , Plus0 -> true ; ;
type _ t = Int : int t ; ;
let f ( x : bool t ) = match x with _ -> . ; ;
let f ( ) = match None with _ -> . ; ;
let g ( ) = match None with _ -> ( ) | exception _ -> . ; ;
let h ( ) = match None with _ -> . | exception _ -> . ; ;
let f x = match x with _ -> ( ) | None -> . ; ;
let f x y = match 1 with 1 when x = y -> 1 ; ;
type _ choice = Left : label choice | Right : tag choice ; ;
let f : label choice -> bool = function Left -> true ; ;