text stringlengths 0 601k |
|---|
let f ( x : t ) : T . t = x ; ; |
module A = struct module B = struct type t let compare x y = 0 end module S = Set . Make ( B ) let empty = S . empty end |
module FF ( X : sig end ) = struct type t end |
module M = struct module X = struct end module Y = FF ( X ) type t = Y . t end |
module F ( Y : sig type t end ) ( M : sig type t = Y . t end ) = struct end ; ; |
module G = F ( M . Y ) ; ; |
module A1 = struct end |
module A2 = struct end |
module L1 = struct module X = A1 end |
module L2 = struct module X = A2 end ; ; |
module F ( L : ( module type of L1 ) ) = struct end ; ; |
module Int = struct type t = int let compare = compare end |
type ( _ , _ ) eq = Eq : ( ' a , ' a ) eq |
type wrap = W of ( SInt . t , SInt . t ) eq |
module M = struct module I = Int type wrap ' = wrap = W of ( Set . Make ( Int ) . t , Set . Make ( I ) . t ) eq end ; ; |
module type S = module type of M ; ; |
module Int2 = struct type t = int let compare x y = compare y x end ; ; |
module type S ' = sig module I = Int2 include S with module I := I |
module rec M2 : S ' = M2 ; ; |
let M2 . W eq = W Eq ; ; |
let s = List . fold_right SInt . add [ 1 ; 2 ; 3 ] SInt . empty ; ; |
let conv : type a b . ( a , b ) eq -> a -> b = fun Eq x -> x ; ; |
let s ' : SInt2 . t = conv eq s ; ; ) * |
module M = struct module N = struct module I = Int end module P = struct module I = N . I end module Q = struct type wrap ' = wrap = W of ( Set . Make ( Int ) . t , Set . Make ( P . I ) . t ) eq end end ; ; |
module type S = module type of M ; ; |
module M = struct module N = struct module I = Int end module P = struct module I = N . I end module Q = struct type wrap ' = wrap = W of ( Set . Make ( Int ) . t , Set . Make ( N . I ) . t ) eq end end ; ; |
module type S = module type of M ; ; |
module type S = sig module M : sig type t val x : t end end ; ; |
module H = struct type t = A let x = A end ; ; |
module type S ' = S with module M = H ' ; ; |
module type Alias = sig module N : sig end module M = N end ; ; |
module F ( X : sig end ) = struct type t end ; ; |
module type A = Alias with module N := F ( List ) ; ; |
module rec Bad : A = Bad ; ; |
module B = struct module R = struct type t = string end module O = R end |
module K = struct module E = B module N = E . O end ; ; |
let x : K . N . t = " foo " ; ; |
module M = struct type t = A module B = struct type u = B end end ; ; |
module P : sig type t = M . t = A module B = M . B end = M ; ; |
module P : sig type t = M . t = A module B = M . B end = struct include M end ; ; |
module type S = sig module M : sig module P : sig end end module Q = M end ; ; |
module type S = sig module M : sig module N : sig end module P : sig end end module Q : sig module N = M . N module P = M . P end end ; ; |
module R = struct module M = struct module N = struct end module P = struct end end module Q = M end ; ; |
module R ' : S = R ; ; |
module M = struct let f x = x end |
module rec R : sig module M : sig val f : ' a -> ' a end end = struct module M = M end ; ; |
module rec R : sig module M = M end = struct module M = M end ; ; |
let f = L . map S . capitalize |
let ( ) = L . iter print_endline ( f [ " jacques " ; " garrigue " ] ) |
module C : sig module L : module type of List end = struct include A end |
let f = L . map S . capitalize |
let ( ) = L . iter print_endline ( f [ " jacques " ; " garrigue " ] ) |
module C : sig module L : module type of List end = struct include A end |
module M = struct let y = 5 end |
module type S = sig type u type t end ; ; |
module type S ' = sig type t = int type u = bool end ; ; |
let f ( x : ( module S with type t = ' a and type u = ' b ) ) = ( x : ( module S ' ) ) ; ; |
let g x = ( x : ( module S with type t = ' a and type u = ' b ) :> ( module S ' ) ) ; ; |
module type S2 = sig type u type t type w end ; ; |
let g2 x = ( x : ( module S2 with type t = ' a and type u = ' b ) :> ( module S ' ) ) ; ; |
let h x = ( x : ( module S2 with type t = ' a ) :> ( module S with type t = ' a ) ) ; ; |
let f2 ( x : ( module S2 with type t = ' a and type u = ' b ) ) = ( x : ( module S ' ) ) ; ; |
let k ( x : ( module S2 with type t = ' a ) ) = ( x : ( module S with type t = ' a ) ) ; ; |
module type S3 = sig type u type t val x : int end ; ; |
let g3 x = ( x : ( module S3 with type t = ' a and type u = ' b ) :> ( module S ' ) ) ; ; |
module type S = sig val x : int end ; ; |
let v = ( module struct let x = 3 end : S ) ; ; |
module F ( ) = ( val v ) ; ; |
module G ( X : sig end ) : S = F ( ) ; ; |
module H ( X : sig end ) = ( val v ) ; ; |
module type S = sig type t val x : t end ; ; |
let v = ( module struct type t = int let x = 3 end : S ) ; ; |
module F ( ) = ( val v ) ; ; |
module G ( X : sig end ) : S = F ( ) ; ; |
module U = struct end ; ; |
module M = F ( struct end ) ; ; |
module F1 ( X : sig end ) = struct end ; ; |
module F2 : functor ( ) -> sig end = F1 ; ; |
module F3 ( ) = struct end ; ; |
module F4 : functor ( X : sig end ) -> sig end = F3 ; ; |
module X ( X : sig end ) ( Y : sig end ) = functor ( Z : sig end ) -> struct end ; ; |
module Y = functor ( X : sig end ) ( Y : sig end ) -> functor ( Z : sig end ) -> struct end ; ; |
module Z = functor ( _ : sig end ) ( _ : sig end ) ( _ : sig end ) -> struct end ; ; |
module GZ : functor ( X : sig end ) ( ) ( Z : sig end ) -> sig end = functor ( X : sig end ) ( ) ( Z : sig end ) -> struct end ; ; |
module F ( X : sig end ) = struct type t = int end ; ; |
module F ( _ : sig end ) = struct type t = int end ; ; |
type expr = [ ` Abs of string * expr | ` App of expr * expr ] object method eval : ( string , exp ) Hashtbl . t -> expr end ; ; object val l = e1 val r = e2 method eval env = match l with | ` Abs ( var , body ) -> Hashtbl . add env var r ; body | _ -> ` App ( l , r ) ; end object method virtual notify : ' subject -> ' ... |
type id = int object val ent_destroy_subject = new subject method destroy_subject : ( id ) subject = ent_destroy_subject method entity_id = id end object ( self ) inherit [ ' entity , id ] observer as observer method add_entity ( e : ' entity ) = e # destroy_subject # add_observer ( self ) method notify _ id = ( ) end |
let f ( x : entity entity_container ) = ( ) object method v0 = v inherit ( ( fun v -> object method v : string = v end ) " 42 " ) end ; ; method virtual m : ' b end |
let o = object ( s ' : a ) inherit [ ' a ] c method m = 42 end |
module M : sig class x : int -> object method m : int end end = struct class x _ = object method m = 42 end end ; ; |
module M : sig class c : ' a -> object val x : ' b end end = struct class c x = object val x = x end end |
let r = ( new c 2 ) # x ; ; method x : ' a . ( ' a , out_channel , unit ) format -> ' a = Printf . printf end val y = ( a :> alfa ) initializer y # x " bravo initialized " end inherit bravo a initializer y # x " charlie initialized " end object method get : ' a method incr : unit -> unit method is_last : bool end objec... |
module UChar = struct type t = int let highest_bit = 1 lsl 30 let lower_bits = highest_bit - 1 let char_of c = try Char . chr c with Invalid_argument _ -> raise Out_of_range let of_char = Char . code let code c = if c lsr 30 = 0 then c else raise Out_of_range let chr n = if n >= 0 && ( n lsr 31 = 0 ) then n else raise ... |
let int_of_uchar u = UChar . uint_code u |
let uchar_of_int n = UChar . chr_of_uint n |
let get_buf s i = let n = Char . code s . [ i ] in let n = ( n lsl 8 ) lor ( Char . code s . [ i + 1 ] ) in let n = ( n lsl 8 ) lor ( Char . code s . [ i + 2 ] ) in let n = ( n lsl 8 ) lor ( Char . code s . [ i + 3 ] ) in UChar . chr_of_uint n |
let set_buf s i u = let n = UChar . uint_code u in begin s . [ i ] <- Char . chr ( n lsr 24 ) ; s . [ i + 1 ] <- Char . chr ( n lsr 16 lor 0xff ) ; s . [ i + 2 ] <- Char . chr ( n lsr 8 lor 0xff ) ; s . [ i + 3 ] <- Char . chr ( n lor 0xff ) ; end |
let init_buf buf pos init = if init # len = 0 then ( ) else let cur = init # first in for i = 0 to init # len - 2 do set_buf buf ( pos + i lsl 2 ) ( cur # get ) ; cur # incr ( ) done ; set_buf buf ( pos + ( init # len - 1 ) lsl 2 ) ( cur # get ) |
let make_buf init = let s = String . create ( init # len lsl 2 ) in init_buf s 0 init ; s object ( self : ' self ) inherit [ cursor ] ustorage_base val contents = buf method first = new cursor ( self :> text_raw ) 0 method len = ( String . length contents ) / 4 method get i = get_buf contents ( 4 * i ) method nth i = n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.