text stringlengths 0 601k |
|---|
type a = A ; ; A ; ; |
module TypEq = struct type ( _ , _ ) t = Eq : ( ' a , ' a ) t end |
module type T = sig type _ is_t = Is : ( ' a , ' b ) TypEq . t -> ' a is_t val is_t : unit -> unit is_t option end |
module Make ( M : T ) = struct let _ = match M . is_t ( ) with | None -> 0 | Some _ -> 0 let f ( ) = match M . is_t ( ) with None -> 0 end ; ; |
module Make2 ( M : T ) = struct type t = T of unit M . is_t let g : t -> int = function _ -> . end ; ; |
type t = A : t ; ; |
module X1 : sig end = struct let _f ~ x = function | A -> let x = ( ) in x end ; ; |
module X2 : sig end = struct let x = 42 let _f = function | A -> let x = ( ) in x end ; ; |
module X3 : sig end = struct module O = struct let x = 42 end open O let _f = function | A -> let x = ( ) in x end ; ; |
module M1 = struct type t = { x : int ; y : int } type u = { x : bool ; y : bool } end ; ; |
module OK = struct open M1 let f1 ( r : t ) = r . x let f2 r = ignore ( r : t ) ; r . x let f3 ( r : t ) = match r with { x ; y } -> y + y end ; ; |
module F1 = struct open M1 let f r = match r with { x ; y } -> y + y |
module F2 = struct open M1 let f r = ignore ( r : t ) ; match r with { x ; y } -> y + y |
module M = struct type t = { x : int } type u = { x : bool } end ; ; |
let f ( r : M . t ) = r . M . x ; ; |
let f ( r : M . t ) = r . x ; ; |
let f ( { x } : M . t ) = x ; ; |
module M = struct type t = { x : int ; y : int } end ; ; |
module N = struct type u = { x : bool ; y : bool } end ; ; |
module OK = struct open M open N let f ( r : M . t ) = r . x end ; ; |
module M = struct type t = { x : int } module N = struct type s = t = { x : int } end type u = { x : bool } end ; ; |
module OK = struct open M . N let f ( r : M . t ) = r . x end ; ; |
module M = struct type u = { x : bool ; y : int ; z : char } type t = { x : int ; y : bool } end ; ; |
module OK = struct open M let f { x ; z } = x , z |
module F3 = struct open M let r = { x = true ; z ' = z ' } |
module OK = struct type u = { x : int ; y : bool } type t = { x : bool ; y : int ; z : char } let r = { x = 3 ; y = true } |
module F4 = struct type foo = { x : int ; y : int } type bar = { x : int } let b : bar = { x = 3 ; y = 4 } |
module M = struct type foo = { x : int ; y : int } end ; ; |
module N = struct type bar = { x : int ; y : int } end ; ; |
let r = { M . x = 3 ; N . y = 4 ; } ; ; |
module MN = struct include M include N end |
module NM = struct include N include M end ; ; |
let r = { MN . x = 3 ; NM . y = 4 } ; ; |
module M = struct type foo = { x : int ; y : int } type bar = { x : int ; y : int ; z : int } end ; ; |
module F5 = struct open M let f r = ignore ( r : foo ) ; { r with x = 2 ; z = 3 } end ; ; |
module M = struct include M type other = { a : int ; b : int } end ; ; |
module F6 = struct open M let f r = ignore ( r : foo ) ; { r with x = 3 ; a = 4 } end ; ; |
module F7 = struct open M let r = { x = 1 ; y = 2 } let r : other = { x = 1 ; y = 2 } end ; ; |
module A = struct type t = { x : int } end |
module B = struct type t = { x : int } end ; ; |
let f ( r : B . t ) = r . A . x ; ; |
module F8 = struct type t = { x : int ; yyy : int } let a : t = { x = 1 ; yyz = 2 } end ; ; |
module Shadow1 = struct type t = { x : int } module M = struct type s = { x : string } end open M let y : t = { x = 0 } end ; ; |
module Shadow2 = struct type t = { x : int } module M = struct type s = { x : string } end open M let y = { x = " " } end ; ; |
module P6235 = struct type t = { loc : string ; } type v = { loc : string ; x : int ; } type u = [ ` Key of t ] let f ( u : u ) = match u with ` Key { loc } -> loc end ; ; |
module P6235 ' = struct type t = { loc : string ; } type v = { loc : string ; x : int ; } type u = [ ` Key of t ] let f = function | ( _ : u ) when false -> " " ` | Key { loc } -> loc end ; ; |
module Unused : sig type unused = int end ; ; |
module Unused_nonrec : sig type nonrec used = int type nonrec unused = used end ; ; |
module Unused_rec : sig type unused = A of unused end ; ; |
module Unused_exception : sig exception Nobody_uses_me end ; ; |
module Unused_extension_constructor : sig type t = . . type t = . . type t += Nobody_uses_me end ; ; |
module Unused_exception_outside_patterns : sig val falsity : exn -> bool exception Nobody_constructs_me let falsity = function | Nobody_constructs_me -> true | _ -> false end ; ; |
module Unused_extension_outside_patterns : sig type t = . . val falsity : t -> bool type t = . . type t += Nobody_constructs_me let falsity = function | Nobody_constructs_me -> true | _ -> false end ; ; |
module Unused_private_exception : sig type exn += private Private_exn exception Private_exn end ; ; |
module Unused_private_extension : sig type t = . . type t += private Private_ext type t = . . type t += Private_ext end ; ; |
type t = < foo : int [ @ foo ] > |
let _ = [ % foo : < foo : t > ] |
type foo += private A of int |
let f : ' a ' b ' c . < . . > = assert false |
let ( ) = let module M = ( functor ( T : sig end ) -> struct end ) ( struct end ) in ( ) |
let f = function x [ @ wee ] -> ( ) |
let f = function | ' 1 ' . . ' 9 ' | ' 1 ' . . ' 8 ' -> ( ) | ' a ' . . ' z ' -> ( ) |
let f = function | [ | x1 ; x2 ] | -> ( ) | [ | ] | -> ( ) | [ | x ] [ |@ foo ] -> ( ) | _ -> ( ) |
let g = function | { l = x } -> ( ) | { l1 = x ; l2 = y } [ @ foo ] -> ( ) | { l1 = x ; l2 = y ; _ } -> ( ) |
let h = fun ? l ( : p = 1 ) ? y : u ? x ( : x = 3 ) -> 2 |
let _ = function | a , s , ba1 , ba2 , ba3 , bg -> begin ignore ( Array . get x 1 + Array . get [ | ] | 0 + Array . get [ | 1 ] | 1 + Array . get [ | 1 ; 2 ] | 2 ) ; ignore ( [ String . get s 1 ; String . get " " 2 ; String . get " 123 " 3 ] ) ; ignore ( ba1 . { 0 } + ba2 . { 1 , 2 } + ba3 . { 3 , 4 , 5 } ) ignore ( bg... |
let f ( type t ) ( ) = let exception F of t in ( ) ; let exception G of t in ( ) ; let exception E of t in ( fun x -> E x ) , ( function E _ -> print_endline " OK " | _ -> print_endline " KO " ) |
let inj1 , proj1 = f ( ) |
let inj2 , proj2 = f ( ) |
let ( ) = proj1 ( inj1 42 ) |
let ( ) = proj1 ( inj2 42 ) |
let _ = fun ( x : < x : int ) > y z -> ( y :> ' a ) , ( x :> ' a ) , ( z :> ' a ) ; ; method f = ( new c ( ) : int c ) inherit [ ' a ] c ( ) end ; ; |
let _ = let module M = struct type t = { x : int } end in let f M . ( x ) = ( ) in let g M . { x } = ( ) in let h = function M . [ ] | M . [ a ] | M . ( a :: q ) -> ( ) in let i = function M . [ ] || | M . [ | x ] | -> true | _ -> false in ( ) constraint ' a = < . . > -> unit method m = ( fun x -> ( ) : ' a ) end |
let f : type a ' . a ' = assert false |
let foo : type a ' b ' . a ' -> b ' = fun a -> assert false |
let foo : type t ' . t ' = fun ( type t ' ) -> ( assert false : t ' ) |
let foo : ' t . ' t = fun ( type t ) -> ( assert false : t ) |
let foo : type a ' b ' c ' t . a ' -> b ' -> c ' -> t = fun a b c -> assert false |
let f x = x . contents <- ( print_string " coucou " ; x . contents ) |
let ( ~$ ) x = Some x |
let g x = ~$ ( x . contents ) |
let ( ~$ ) x y = ( x , y ) |
let g x y = ~$ ( x . contents ) ( y . contents ) |
let tail1 = ( [ 1 ; 2 ] ) [ @ hello ] |
let tail2 = 0 ( ( [ :: 1 ; 2 ] ) [ @ hello ] ) |
let f ~ l ( : l [ @ foo ] ) = l ; ; |
let test x y = ( ( ) [ +@ foo ] ) x y ; ; |
let test x = ( ( ) [ ~-@ foo ] ) x ; ; |
let test contents = { contents = contents [ @ foo ] } ; ; |
let test f x = f ~ x ( : x [ @ foo ] ) ; ; |
let f = function ( ( ` A ` | B ) [ @ bar ] ) | ` C -> ( ) ; ; |
let f = function _ ( :: _ :: _ [ @ foo ] ) -> ( ) | _ -> ( ) ; ; |
let ( ) = foo . ## bar := ( ) ; ; let open M in object method f : t = x end ; ; let open M in object method f : t end ; ; |
module Exotic_list = struct module Inner = struct type ( ' a , ' b ) t = [ ] | ( ) :: of ' a * ' b * ( ' a , ' b ) t end let Inner . ( ) ( :: x , y , Inner . [ ] ) = Inner . ( ) ( :: 1 , " one " , Inner . [ ] ) end |
module Indexop = struct module Def = struct let ( . [ ] % ) = Hashtbl . find let ( . [ ] % <- ) = Hashtbl . add let ( . ( ) % ) = Hashtbl . find let ( . ( ) % <- ) = Hashtbl . add let ( . { } % ) = Hashtbl . find let ( . { } % <- ) = Hashtbl . add end ; ; let h = Hashtbl . create 17 in h . Def . [ " % one " ] <- 1 ; h ... |
let x = ` Foo |
let x = ` Bar |
type ( ' + a , ' - a ' , ' a ' b ' , ' ab ' , ' abcd ' , ' x ) t = ' a * ' a ' * ' a ' b ' * ' ab ' * ' abcd ' * ' x as ' a ' |
let f = function | lazy ( A foo ) -> foo |
let ( ) = f ( fun ( type t ) -> x ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.