text
stringlengths
0
601k
module type S = sig include Set . S module E : sig val x : int end end
module Make ( O : Set . OrderedType ) : S with type elt = O . t = struct include Set . Make ( O ) module E = struct let x = 1 end end
module rec A : Set . OrderedType = struct type t = int let compare = Stdlib . compare end module C = Make ( A ) include C end
module type S = sig module type T module X : T end
module F ( X : S ) = X . X
module M = struct module type T = sig type t end module X = struct type t = int end end
module Common0 = struct type msg = Msg let handle_msg = ref ( function _ -> failwith " Unable to handle message " ) let extend_handle f = let old = ! handle_msg in handle_msg := f old let q : _ Queue . t = Queue . create ( ) let add msg = Queue . add msg q let handle_queue_messages ( ) = Queue . iter ! handle_msg q end
let q ' : Common0 . msg Queue . t = Common0 . q
module Common = struct type msg = . . let handle_msg = ref ( function _ -> failwith " Unable to handle message " ) let extend_handle f = let old = ! handle_msg in handle_msg := f old let q : _ Queue . t = Queue . create ( ) let add msg = Queue . add msg q let handle_queue_messages ( ) = Queue . iter ! handle_msg q end
module M1 = struct type Common . msg += Reload of string | Alert of string let handle fallback = function Reload s -> print_endline ( " Reload " ^ s ) | Alert s -> print_endline ( " Alert " ^ s ) | x -> fallback x let ( ) = Common . extend_handle handle let ( ) = Common . add ( Reload " config . file " ) let ( ) = Comm...
let should_reject = let table = Hashtbl . create 1 in fun x y -> Hashtbl . add table x y
type ' a t = ' a option
let is_some = function | None -> false | Some _ -> true
let should_accept ? x ( ) = is_some x let foo ` Test = ( ) let wrap f ` Test = f let bar = wrap ( ) end
let f ( ) = let module S = String in let module N = Map . Make ( S ) in N . add " sum " 41 N . empty ; ;
module X = struct module Y = struct module type S = sig type t end end end ) *
type ' a arg_t = ' at constraint ' a = ( module Y . S with type t = ' at )
type t = ( module X . Y . S with type t = unit )
let f ( x : t arg_t ) = ( )
let ( ) = f ( )
module type S = sig type a type b end
module Foo ( Bar : S with type a = private [ > ` A ] ) ( Baz : S with type b = private < b : Bar . b ; . . ) > = struct end
module A = struct module type A_S = sig end type t = ( module A_S ) end
module type S = sig type t end
let f ( type a ) ( module X : S with type t = a ) = ( )
let _ = f ( module A )
module A_annotated_alias : S with type t = ( module A . A_S ) = A
let _ = f ( module A_annotated_alias )
let _ = f ( module A_annotated_alias : S with type t = ( module A . A_S ) )
module A_alias_expanded = struct include A_alias end
let _ = f ( module A_alias_expanded : S with type t = ( module A . A_S ) )
let _ = f ( module A_alias_expanded )
let _ = f ( module A_alias : S with type t = ( module A . A_S ) )
let _ = f ( module A_alias )
module Foo ( Bar : sig type a = private [ > ` A ] end ) ( Baz : module type of struct include Bar end ) = struct end
module Bazoinks = struct type a = [ ` A ] end
type ( _ , _ ) eq = Eq : ( ' a , ' a ) eq
let cast : type a b . ( a , b ) eq -> a -> b = fun Eq x -> x
module Fix ( F : sig type ' a f end ) = struct type ' a fix = ( ' a , ' a F . f ) eq let uniq ( type a ) ( type b ) ( Eq : a fix ) ( Eq : b fix ) : ( a , b ) eq = Eq end
module M = struct module type S = sig type a val v : a end type ' a s = ( module S with type a = ' a ) end
module B = struct class type a = object method a : ' a . ' a M . s -> ' a end end
module B ' = B method a : ' a . ' a M . s -> ' a = fun ( type a ) ( ( module X ) : ( module M . S with type end method a : ' a . ' a M ' . s -> ' a = fun ( type a ) ( ( module X ) : ( module M ' . S with
type a = a ) ) -> X . v end
module type FOO = sig type t end
module type BAR = sig module rec A : ( FOO with type t = < b : B . t ) > and B : FOO end
module A = struct module type S module S = struct end end
module F ( _ : sig end ) = struct module type S module S = A . S end
module M = struct end
module G ( X : F ( N ) . S ) : A . S = X
module F ( _ : sig end ) = struct module type S end
module M = struct end
module G ( X : F ( N ) . S ) : F ( M ) . S = X
module M : sig type make_dec val add_dec : make_dec -> unit type u module Fast : sig type ' d t val create : unit -> ' d t module type S = sig module Data : sig type t end val key : Data . t t end module Register ( D : S ) : sig end val attach : ' d t -> ' d -> unit end = struct type ' d t = unit let create ( ) = ( ) m...
module Simple = struct type ' a t module type S = sig module Data : sig type t end val key : Data . t t end module Register ( D : S ) = struct let key = D . key end module M = struct module Data = struct type t = int end let key : _ t = Obj . magic ( ) end end ; ;
module EM = Simple . Register ( Simple . M ) ; ; Simple . M . key ; ;
module Simple2 = struct type ' a t module type S = sig module Data : sig type t end val key : Data . t t end module M = struct module Data = struct type t = int end let key : _ t = Obj . magic ( ) end module Register ( D : S ) = struct let key = D . key end module EM = Simple . Register ( Simple . M ) let k : M . Data ...
module rec M : sig external f : int -> int = " % identity " end = struct external f : int -> int = " % identity " end
module type S = sig type t and s = t end ; ;
module type S ' = S with type t := int ; ;
module type S = sig module rec M : sig end and N : sig end end ; ;
module type S ' = S with module M := String ; ;
module M : sig val v : ( # c as ' a ) -> ' a end = struct let v x = ignore ( x :> c ) ; x end ; ;
let id = let module M = struct end in fun x -> x ; ;
let ko = let module M = struct end in fun _ -> ( ) ; ;
module M : sig type ' - a t = private int end = struct type ' + a t = private int end ; ;
module type A = sig type t = X of int end ; ;
type u = X of bool ; ;
module type B = A with type t = u ; ;
module type S = sig exception Foo of int exception Foo of bool end ; ;
module F ( X : sig end ) = struct let x = 3 end ; ;
module C ' : module type of Char = C ; ;
module C3 = struct include Char end ; ;
let f x = let module M = struct module L = List end in M . L . length x ; ;
let g x = let module L = List in L . length ( L . map succ x ) ; ;
module F ( X : sig end ) = Char ; ;
module C4 = F ( struct end ) ; ;
module G ( X : sig end ) = struct module M = X end ; ;
module M = G ( struct end ) ; ;
module M ' = struct module N = struct let x = 1 end module N ' = N end ; ; M ' . N ' . x ; ;
module M ' ' : sig module N ' : sig val x : int end end = M ' ; ; M ' ' . N ' . x ; ;
module M2 = struct include M ' end ; ;
module M3 : sig module N ' : sig val x : int end end = struct include M ' end ; ; M3 . N ' . x ; ;
module M3 ' : sig module N ' : sig val x : int end end = M2 ; ; M3 ' . N ' . x ; ;
module M4 : sig module N ' : sig val x : int end end = struct module N = struct let x = 1 end module N ' = N end ; ; M4 . N ' . x ; ;
module F ( X : sig end ) = struct module N = struct let x = 1 end module N ' = N end ; ;
module G : functor ( X : sig end ) -> sig module N ' : sig val x : int end end = F ; ;
module M5 = G ( struct end ) ; ; M5 . N ' . x ; ;
module M = struct module D = struct let y = 3 end module N = struct let x = 1 end module N ' = N end ; ;
module M1 : sig module N : sig val x : int end module N ' = N end = M ; ; M1 . N ' . x ; ;
module M2 : sig module N ' : sig val x : int end end = ( M : sig module N : sig val x : int end module N ' = N end ) ; ; M2 . N ' . x ; ; N ' . x ; ;
module M = struct module C = Char module C ' = C end ; ;
module M1 : sig module C : sig val escaped : char -> string end module C ' = C end = M ; ;
module M2 : sig module C ' : sig val chr : int -> char end end = ( M : sig module C : sig val chr : int -> char end module C ' = C end ) ; ; StdLabels . List . map ; ;
module type Complex = module type of Complex with type t = Complex . t ; ;
module M : sig module C : Complex end = struct module C = Complex end ; ;
module C = Complex ; ; C . one . Complex . re ; ;
module F ( X : sig module C = Char end ) = struct module C = X . C end ; ;
let f ( x : StringSet . t ) = ( x : SSet . t ) ; ;
module F ( M : sig end ) : sig type t end = struct type t = int end
module T = struct module M = struct end include F ( M ) end ; ;