text
stringlengths
0
601k
module FloatProb : Prob = struct type t = float let to_float p = p let of_float p = p let ( = ) = Float . equal let ( . * ) = ( . * ) let ( . / ) = ( . / ) let ( + ) = ( . + ) let min = Float . min let one = 1 . let zero = 0 . end
let scrape_cmi x = let src = match Cm . guess x with | [ ] -> assert false | [ src ] -> src | _ -> assert false in let top = Hashcons . out_ident & match src . Cm . paths with | [ ] -> Oide_dot ( Oide_ident " NOTOP " , module_name x ) | [ p ] -> p | _ -> assert false in let set_load_path ( ) = let cmt = match src . Cm ...
let test_cmi cmi = let top , fs = scrape_cmi cmi in !!% " % a . @% a . " @ Xoprint . print_ident top Sig . format fs
let is_cached sigfile stamp = if File . Test . _f sigfile then let s = Data . SigFile . unsafe_load sigfile in if s . Data . SigFile . stamp = stamp then Some s else None else None
let scrape_ocamlfind_package destdir apg = let path = destdir ^/ apg . Ocamlfind . Analyzed_group . name ^ " . sig " in match apg . Ocamlfind . Analyzed_group . name with | " predef " -> let sigfile = { Data . SigFile . name = " predef " ; packs = [ ( Oide_ident " predef " , Predefscrape . sig_ ( ) ) ] ; stamp = [ ] } ...
type t = sigset_t ptr
let t = ptr sigset_t
let sigemptyset = foreign " sigemptyset " ( ptr sigset_t @-> returning int )
let empty ( ) = let setp = allocate_n ~ count : 1 sigset_t in begin ignore ( sigemptyset setp ) ; setp end
let sigfillset = foreign " sigfillset " ( ptr sigset_t @-> returning int )
let full ( ) = let setp = allocate_n ~ count : 1 sigset_t in begin ignore ( sigfillset setp ) ; setp end
let sigaddset = foreign " sigaddset " ~ check_errno : true ( ptr sigset_t @-> int @-> returning int )
let add set signal = ignore ( sigaddset set signal )
let sigdelset = foreign " sigdelset " ~ check_errno : true ( ptr sigset_t @-> int @-> returning int )
let del set signal = ignore ( sigdelset set signal )
let sigismember = foreign " sigismember " ~ check_errno : true ( ptr sigset_t @-> int @-> returning int )
let mem set signal = sigismember set signal <> 0
module type Printable = sig type t val print : t -> unit end
module type Printable = sig type t val print : t -> unit end } ] |
module type Comparable = sig type t val compare : t -> t -> int 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 end ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Line 2 , characters 2 - 19 : Type t / 97 came from this include Line 3 , characters 2 - 23 : The value print has no valid type if t / 97 is shadowed } ] |
module type Sunderscore = sig type ( _ , _ ) t
module type Sunderscore = sig type ( _ , ' a ) t = int * ' a end } ] |
module type S0 = sig module rec M : sig type t = M2 . t end and M2 : sig type t = int end does not match its original definition in the constrained signature : Type declarations do not match : type t = int is not included in type t = M2 . t } ] |
module type PrintableComparable = sig type t include Printable with type t := t include Comparable with type t := t end
module type PrintableComparable = sig type t val print : t -> unit val compare : t -> t -> int end } ] |
module type PrintableComparable = sig include Printable include Comparable with type t := t end
module type PrintableComparable = sig type t val print : t -> unit val compare : t -> t -> int end } ] |
module type ComparableInt = Comparable with type t := int
module type ComparableInt = sig val compare : int -> int -> int end } ] |
module type S = sig type t val f : t -> t end
module type S = sig type t val f : t -> t end } ] |
module type S ' = S with type t := int
module type S ' = sig val f : int -> int end } ] |
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 S = sig type ' a t val map : ( ' a -> ' b ) -> ' a t -> ' b t end
module type S1 = sig val map : ( ' a -> ' b ) -> ' a list -> ' b list end } ] |
module type S2 = S with type ' a t := ( string * ' a ) list
module type S2 = sig val map : ( ' a -> ' b ) -> ( string * ' a ) list -> ( string * ' b ) list end } ] |
module type S3 = S with type _ t := int
module type S3 = sig val map : ( ' a -> ' b ) -> int -> int 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 module T : sig type exp type arg end val f : T . exp -> T . arg end
module M : sig type exp = string type arg = int end
module type S ' = sig val f : M . exp -> M . arg end } ] |
module type S = sig type ' a t end with type ' a t := unit
module type S = sig end } ] |
module type S = sig type t = [ ` Foo ] type s = private [ < t ]
module type S = sig type s = private [ < ` Foo ] end } ] |
module type S = sig type t = . . type t += A
module type S = sig type exn += A end } ] |
type ' a t constraint ' a = ' b list
module type S = sig type ' a t2 constraint ' a = ' b list type ' a mylist = ' a list val x : int mylist t2
type ' a t constraint ' a = ' b list
module type S = sig type ' a mylist = ' a list val x : int mylist t end } ] |
type ' a t constraint ' a = ' b list
module type S = sig type ' a t2 constraint ' a = ' b list type ' a mylist = ' a list val x : int mylist t2
type ' a t constraint ' a = ' b list types ( other than when replacing a type constructor with a type constructor with the same arguments ) . } ] |
module type S = sig module M1 : sig type t = int end module M2 = M1 module M3 : sig module M = M2 end module F ( X : sig module M = M1 end ) : sig type t end type t = F ( M3 ) . t
module type S = sig module M1 : sig type t = int end module M2 = M1 module M3 : sig module M = M2 end module F : functor ( X : sig module M = M1 end ) -> sig type t end type t = F ( M3 ) . t end } ] |
type ( _ , _ ) eq = Refl : ( ' a , ' a ) eq
module Equal ( M : Set . OrderedType ) ( N : Set . OrderedType with type t = M . t ) : sig val eq : ( Set . Make ( M ) . t , Set . Make ( N ) . t ) eq type meq = Eq of ( Set . Make ( M ) . t , Set . Make ( M ) . t ) eq module type S = sig module N = M type neq = meq = Eq of ( Set . Make ( M ) . t , Set . Make ( N ) . t...
type ( _ , _ ) eq = Refl : ( ' a , ' a ) eq ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ does not match its original definition in the constrained signature : Modules do not match : sig type t = M . t val compare : t -> t -> int end is not included in ( module M ) } ] |
module type S = sig module M : sig type t val x : t end val y : M . t module A : sig module M : sig type t val z : t -> M . t end end
module type S = sig module M : sig val x : float end val y : float module A : sig module M : sig type t val z : t -> float end end end } ] |
module type S = sig module type S1 = sig type t type a val x : t end module M1 : S1 type a = M1 . t module M2 : S1 type b = M2 . t
module type S = sig module type S1 = sig type t type a val x : t end module M1 : sig type a = int val x : int end type a = int module M2 : sig type t type a = int val x : t end type b = M2 . t end } ] |
module type S = sig module M : sig type t end module A = M in the constrained signature ( as A ) . } ] |
module type S = sig module M : sig type t type u end module F ( X : sig type t end ) : sig type t end type t = F ( M ) . t end
module type S = sig module M : sig type t type u end module F : functor ( X : sig type t end ) -> sig type t end type t = F ( M ) . t end } ] |
module type S2 = S with type M . t := float ^^^^^^^^^^^^^^^^^^^^^^^^ type F ( M ) . t ill - typed in the constrained signature : Modules do not match : sig type u = M . u end is not included in sig type t end The type ` t ' is required but not provided } ] |
module type S2 = S with type M . u := float
module type S2 = sig module M : sig type t end module F : functor ( X : sig type t end ) -> sig type t end type t = F ( M ) . t end } ] |
module Id ( X : sig type t end ) = struct type t = X . t end
module type S3 = sig module rec M : sig type t = A of Id ( M2 ) . t end and M2 : sig type t end
module Id : functor ( X : sig type t end ) -> sig type t = X . t end type Id ( M2 ) . t ill - typed in the constrained signature : Modules do not match : sig end is not included in sig type t end The type ` t ' is required but not provided } ] |
module A = struct module P = struct type t let x = 1 end end
module type S = sig module M : sig module N : sig module P : sig type t end end end type t = M . N . P . t
module A : sig module P : sig type t val x : int end end
module type S = sig module M : sig end type t = A . P . t end } ] |
module type S = sig module M : sig module N : sig module P : sig type t end end end module Alias = M 1 | . . . . . . . . . . . . . . . . sig 2 | module M : sig 3 | module N : sig 4 | module P : sig 5 | type t 6 | end 7 | end 8 | end 9 | module Alias = M in the constrained signature ( as Alias ) . } ] |
type named_type = ( string * typedecl )
let rec pp_print_named_type : Format . formatter -> named_type -> unit = function | fmt -> ( function | _a0 -> ( ( function | fmt -> ( function | ( _a0 , _a1 ) -> Format . fprintf fmt " [ @< 1 ( >% a , , @% a ) ] " @ pp_print_string _a0 pp_print_typedecl _a1 ) ) ) fmt _a0 ) function | fmt -> ( function | _a0 -> pp_prin...
type plugin = { transform : mtyps -> stru option ; position : string option ; filter : ( string -> bool ) option ; }
let apply_filter = function | f -> ( function | ( m : mtyps ) -> ( let f = function | ` Single ( s , _ ) as x -> if f s then Some x else None | ` Mutual ls -> let x = Listf . filter_map ( function | ( s , _ ) as x -> if f s then Some x else None ) ls in ( match x with | [ ] -> None | x [ ] :: -> Some ( ` Single x ) | y...
let stru_from_mtyps ~ f ( : aux : named_type -> typedecl ) = function | ( x : mtyps ) -> ( ( match x with | [ ] -> None | _ -> let xs : stru list = List . map ( function | ` Mutual tys -> let v = and_of_list ( List . map aux tys ) in ( ` Type ( v :> Astfn . typedecl ) :> Astfn . stru ) | ` Single ty -> let v = aux ty i...
let stru_from_ty ~ f ( : f : string -> stru ) = function | ( x : mtyps ) -> ( let tys : string list = Listf . concat_map ( function | ` Mutual tys -> List . map ( function | ( ( x , _ ) : named_type ) -> x ) tys | ` Single ( x , _ ) -> [ x ] ) x in sem_of_list ( List . map f tys ) : stru )
let mk_transform_type_eq = function | ( ) -> object ( self : ' self_type ) val transformers = Hashtbl . create 50 inherit ObjsN . map as super method ! stru = ( function | ( ` Type ( ` TyDcl ( _name , vars , ctyp , _ ) ) : Astfn . stru ) as x -> let r = match ctyp with | ` TyEq ( _ , t ) -> Ctyp . qualified_app_list t ...
let transform_mtyps = function | ( lst : mtyps ) -> let obj = mk_transform_type_eq ( ) in let item1 = List . map ( function | ` Mutual ls -> ` Mutual ( List . map ( function | ( s , ty ) -> ( s , ( obj # typedecl ty ) ) ) ls ) | ` Single ( s , ty ) -> ` Single ( s , ( obj # typedecl ty ) ) ) lst in let new_types = obj ...
module M = struct type t end ; ; [ %% expect { |
module M : sig type t end } ] |
module type Accepted = sig type t := int type ' a u := ' a list type ' a v := ( string * ' a ) list module T := M type _ w := T . t val f : t u -> char w v end ; ; [ %% expect { |
module type Accepted = sig val f : int list -> ( string * M . t ) list end } ] |
module F ( X : sig type t end ) = struct type t = X . t end ; ; [ %% expect { |
module F : functor ( X : sig type t end ) -> sig type t = X . t end } ] |
module type Accepted2 = sig module N := F ( M ) val foo : N . t -> int end ; ; [ %% expect { |