Source

amall / src / it_type.ml

Full commit
module type IT
 =
  sig
    module It_IO :
      sig
        type m +'a;
        value return : 'a -> m 'a;
        value bind : ('a -> m 'b) -> m 'a -> m 'b;
        value bind_rev : m 'a -> ('a -> m 'b) -> m 'b;
        value error : exn -> m 'a;
        value catch : (unit -> m 'a) -> (exn -> m 'a) -> m 'a;
        type output_channel;
        value stdout : output_channel;
        value write : output_channel -> string -> m unit;
        type input_channel;
        value open_in : string -> m input_channel;
        value close_in : input_channel -> m unit;
        value read_into : input_channel -> string -> int -> int -> m int;
        value runIO : m 'a -> [= `Error of exn | `Ok of 'a ];
      end;
    module Subarray :
      sig
        module C :
          sig
            type t 'a =
              private
                { arr : array 'a; ofs : int; len : int };
            value empty : t 'a;
            value mk : ~arr:array 'a -> ~ofs:int -> ~len:int -> t 'a;
          end;
        type t 'a =
          C.t 'a == private
            { arr : array 'a; ofs : int; len : int };
        value length : t 'a -> int;
        value get : t 'a -> int -> 'a;
        value empty : C.t 'a;
        value replace_with_substring :
          array char -> string -> int -> int -> C.t char;
        value of_string : string -> C.t char;
        value of_array : array 'a -> C.t 'a;
        value of_array_sub : array 'a -> int -> int -> C.t 'a;
        value of_list : list 'a -> C.t 'a;
        value of_elem : 'a -> C.t 'a;
        type dir = Subarray.dir == [ L | R ];
        value fold : dir -> ('a -> 'b -> 'a) -> 'a -> C.t 'b -> 'a;
        value iter : ('a -> unit) -> C.t 'a -> unit;
        value to_list : C.t 'a -> list 'a;
        value to_string : C.t char -> string;
        value append_to_list_rev : C.t 'a -> list 'a -> list 'a;
        value get_first_item : C.t 'a -> option 'a;
        value destruct_first_item : C.t 'a -> option ('a * C.t 'a);
        value sub : C.t 'a -> ~ofs:int -> ~len:int -> C.t 'a;
        value split_at : int -> C.t 'a -> (C.t 'a * C.t 'a);
        value drop : int -> C.t 'a -> C.t 'a;
        value break : ('a -> bool) -> C.t 'a -> (C.t 'a * C.t 'a);
        value break_limit :
          ~limit:int ->
          ('a -> bool) ->
          C.t 'a -> [> `Found of (C.t 'a * C.t 'a) | `Hit_end | `Hit_limit ];
        value drop_while : ('a -> bool) -> C.t 'a -> C.t 'a;
        value is_empty : C.t 'a -> bool;
        value buffer_add : Buffer.t -> C.t char -> unit;
        value map : ('a -> 'b) -> C.t 'a -> C.t 'b;
        value copy : C.t 'a -> C.t 'a;
        value concat_splitted : C.t 'a -> C.t 'a -> C.t 'a;
      end;
    module S :
      sig
        module C :
          sig
            type t 'a =
              Subarray.C.t 'a == private
                { arr : array 'a; ofs : int; len : int };
            value empty : t 'a;
            value mk : ~arr:array 'a -> ~ofs:int -> ~len:int -> t 'a;
          end;
        type t 'a =
          Subarray.C.t 'a == private
            { arr : array 'a; ofs : int; len : int };
        value length : t 'a -> int;
        value get : t 'a -> int -> 'a;
        value empty : C.t 'a;
        value replace_with_substring :
          array char -> string -> int -> int -> C.t char;
        value of_string : string -> C.t char;
        value of_array : array 'a -> C.t 'a;
        value of_array_sub : array 'a -> int -> int -> C.t 'a;
        value of_list : list 'a -> C.t 'a;
        value of_elem : 'a -> C.t 'a;
        type dir = Subarray.dir == [ L | R ];
        value fold : dir -> ('a -> 'b -> 'a) -> 'a -> C.t 'b -> 'a;
        value iter : ('a -> unit) -> C.t 'a -> unit;
        value to_list : C.t 'a -> list 'a;
        value to_string : C.t char -> string;
        value append_to_list_rev : C.t 'a -> list 'a -> list 'a;
        value get_first_item : C.t 'a -> option 'a;
        value destruct_first_item : C.t 'a -> option ('a * C.t 'a);
        value sub : C.t 'a -> ~ofs:int -> ~len:int -> C.t 'a;
        value split_at : int -> C.t 'a -> (C.t 'a * C.t 'a);
        value drop : int -> C.t 'a -> C.t 'a;
        value break : ('a -> bool) -> C.t 'a -> (C.t 'a * C.t 'a);
        value break_limit :
          ~limit:int ->
          ('a -> bool) ->
          C.t 'a -> [> `Found of (C.t 'a * C.t 'a) | `Hit_end | `Hit_limit ];
        value drop_while : ('a -> bool) -> C.t 'a -> C.t 'a;
        value is_empty : C.t 'a -> bool;
        value buffer_add : Buffer.t -> C.t char -> unit;
        value map : ('a -> 'b) -> C.t 'a -> C.t 'b;
        value copy : C.t 'a -> C.t 'a;
        value concat_splitted : C.t 'a -> C.t 'a -> C.t 'a;
      end;
    type err_msg = exn;
    exception EIO of (exn * It_Types.place);
    exception Iteratees_err_msg of err_msg;
    exception Divergent_iteratee of It_Types.place;
    value ierr_of_merr : err_msg -> err_msg;
    type stream 'a =

        [ EOF of option err_msg | Chunk of Subarray.t 'a ];
    value chunk_of : 'a -> stream 'a;
    value dbgstream : ?addon:string -> stream 'a -> string;
    value dbgstream_char : ?body:int -> stream char -> string;
    value ( >>% ) : It_IO.m 'a -> ('a -> It_IO.m 'b) -> It_IO.m 'b;
    value ( %<< ) : ('a -> It_IO.m 'b) -> It_IO.m 'a -> It_IO.m 'b;
    module Sl :
      sig
        type sl 'a;
        value empty : sl 'a;
        value destr_head : sl 'a -> option (stream 'a * sl 'a);
        value cons : stream 'a -> sl 'a -> sl 'a;
        value get_one_opt : sl 'a -> option (stream 'a);
        value one : stream 'a -> sl 'a;
        value dbgsl : sl 'a -> string;
      end;
    type sl 'a = Sl.sl 'a;
    type iteratee 'a 'b =

        [ IE_done of 'b
        | IE_cont of option err_msg and
            stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a) ];
    value return : 'a -> iteratee 'b 'a;
    value bindI : ('a -> iteratee 'b 'c) -> iteratee 'b 'a -> iteratee 'b 'c;
    value ( =<< ) :
      ('a -> iteratee 'b 'c) -> iteratee 'b 'a -> iteratee 'b 'c;
    value ( >>= ) :
      iteratee 'a 'b -> ('b -> iteratee 'a 'c) -> iteratee 'a 'c;
    value lift : It_IO.m 'a -> iteratee 'b 'a;
    value throw_err : err_msg -> iteratee 'a 'b;
    value throw_err_cont :
      err_msg -> stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a);
    value throw_recoverable_err :
      err_msg ->
      (stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) -> iteratee 'a 'b;
    value set_eof : stream 'a -> err_msg;
    value empty_stream : stream 'a;
    value ie_doneM : 'a -> stream 'b -> It_IO.m (iteratee 'b 'a * sl 'b);
    value ie_contM :
      (stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) ->
      It_IO.m (iteratee 'a 'b * Sl.sl 'c);
    value ie_doneMsl : 'a -> 'b -> It_IO.m (iteratee 'c 'a * 'b);
    value ie_errorMsl : err_msg -> sl 'a -> It_IO.m (iteratee 'a 'b * sl 'a);
    value ie_cont :
      (stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) -> iteratee 'a 'b;
    value liftI : It_IO.m (iteratee 'a 'b) -> iteratee 'a 'b;
    value merr_of_ierr : err_msg -> It_IO.m 'a;
    value joinI : iteratee 'a (iteratee 'b 'c) -> iteratee 'a 'c;
    value run : iteratee 'a 'b -> It_IO.m 'b;
    value stream2list : iteratee 'a (list 'a);
    value get_stream_eof : iteratee 'a (option (option err_msg));
    value is_stream_finished : iteratee 'a (option err_msg);
    value break_fold :
      ('a -> bool) -> ('b -> 'a -> 'b) -> 'b -> iteratee 'a 'b;
    value mapI : ('a -> 'b) -> iteratee 'c 'a -> iteratee 'c 'b;
    value break : ('a -> bool) -> iteratee 'a (list 'a);
    value prepend : (unit -> 'a) -> ('a -> iteratee 'b 'c) -> iteratee 'b 'c;
    value break_chars : (char -> bool) -> iteratee char string;
    value drop_while : ('a -> bool) -> iteratee 'a unit;
    value peek : iteratee 'a (option 'a);
    value head : iteratee 'a 'a;
    value pervasives_eq : 'a -> 'a -> bool;
    value heads : ?eq:('a -> 'a -> bool) -> list 'a -> iteratee 'a int;
    value skip_till_eof : iteratee 'a unit;
    value drop_step : int -> stream 'a -> It_IO.m (iteratee 'a unit * sl 'a);
    value drop : int -> iteratee 'a unit;
    value io_iter : ('a -> It_IO.m unit) -> list 'a -> It_IO.m unit;
    value print_line : string -> It_IO.m unit;
    type enumerator 'a 'b = iteratee 'a 'b -> It_IO.m (iteratee 'a 'b);
    value enum_eof : enumerator 'a 'b;
    value enum_err : err_msg -> enumerator 'a 'b;
    value ( >>> ) : enumerator 'a 'b -> enumerator 'a 'b -> enumerator 'a 'b;
    value enum_pure_1chunk : list 'a -> enumerator 'a 'b;
    value enum_pure_nchunk : list 'a -> int -> enumerator 'a 'b;
    value enum_string : ?chunk_size:int -> string -> enumerator char 'a;
    value mprintf : format4 'a unit string (It_IO.m unit) -> 'a;
    value mres : It_IO.m 'a -> It_IO.m (It_Types.res 'a);
    value _munres : It_Types.res 'a -> It_IO.m 'a;
    value enum_readchars :
      ~buffer_size:int ->
      ~read_func:('a -> string -> int -> int -> It_IO.m int) ->
      'a -> enumerator char 'b;
    value enum_fd : It_IO.input_channel -> enumerator char 'a;
    value enum_file : string -> enumerator char 'a;
    type enumeratee 'a 'b 'c = iteratee 'b 'c -> iteratee 'a (iteratee 'b 'c);
    value take_gen : [= `Drop | `Fail ] -> int -> enumeratee 'a 'a 'b;
    value take : int -> iteratee 'a 'b -> iteratee 'a (iteratee 'a 'b);
    value take_or_fail :
      int -> iteratee 'a 'b -> iteratee 'a (iteratee 'a 'b);
    value map_stream : ('a -> 'b) -> enumeratee 'a 'b 'c;
    value sequence_stream : iteratee 'a 'b -> enumeratee 'a 'b 'c;
    value enum_words : enumeratee char string 'a;
    value array_ensure_size :
      ~default:'a -> ref (array 'a) -> int -> array 'a;
    module SC :
      sig
        type t 'a = Subarray_cat.t 'a;
        value make : list (Subarray.t 'a) -> t 'a;
        value length : t 'a -> int;
        value get : t 'a -> int -> 'a;
        value sub_copy_out : ?ofs:int -> ?len:int -> t 'a -> Subarray.t 'a;
        value append : t 'a -> Subarray.t 'a -> t 'a;
      end;
    module UTF8 :
      sig
        type uchar = private int;
        value utf8_of_char : enumeratee char uchar 'a;
      end;
    value break_copy :
      ~cpred:(char -> bool) ->
      ~outch:It_IO.output_channel -> iteratee char unit;
    value break_limit :
      ~pred:('a -> bool) ->
      ~limit:int ->
      iteratee 'a ([= `Found | `Hit_eof | `Hit_limit ] * Subarray.t 'a);
    value limit : int -> enumeratee 'a 'a 'b;
    value catchk :
      (unit -> iteratee 'a 'b) ->
      (err_msg ->
       (stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) -> iteratee 'a 'b) ->
      iteratee 'a 'b;
    value catch :
      (unit -> iteratee 'a 'b) ->
      (err_msg -> iteratee 'a 'b) -> iteratee 'a 'b;
    value printf : format4 'a unit string (iteratee 'b unit) -> 'a;
    value gather_to_string : iteratee char string;
    module Ops :
      sig
        value ( %<< ) : ('a -> It_IO.m 'b) -> It_IO.m 'a -> It_IO.m 'b;
        value ( >>% ) : It_IO.m 'a -> ('a -> It_IO.m 'b) -> It_IO.m 'b;
        value ( =<< ) :
          ('a -> iteratee 'b 'c) -> iteratee 'b 'a -> iteratee 'b 'c;
        value ( >>= ) :
          iteratee 'a 'b -> ('b -> iteratee 'a 'c) -> iteratee 'a 'c;
        value ( >>> ) :
          enumerator 'a 'b -> enumerator 'a 'b -> enumerator 'a 'b;
      end;
    value feedI :
      (stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) ->
      stream 'a -> It_IO.m (iteratee 'a 'b);
    value feed_it : iteratee 'a 'b -> stream 'a -> iteratee 'a 'b;
    exception Itlist_empty;
    module Anyresult_lasterror :
      sig
        value itlist_step_firstresult_lasterror :
          list (iteratee 'a 'b) ->
          stream 'a ->
          It_IO.m
            [= `Cont of list (iteratee 'a 'b)
             | `First_result of (iteratee 'a 'b * sl 'a)
             | `Last_error of err_msg ];
        value get_any_done : list (iteratee 'a 'b) -> option (iteratee 'c 'b);
        value itlist_anyresult_lasterror :
          list (iteratee 'a 'b) -> iteratee 'a 'b;
      end;
    value itlist_anyresult_lasterror :
      list (iteratee 'a 'b) -> iteratee 'a 'b;
    value junk : iteratee 'a unit;
    exception SInt_overflow;
    exception SInt_not_a_number of string;
    module Reading_ints :
      sig
        value read_uint : iteratee char int;
        value read_uint_nz : iteratee char int;
        value read_int : iteratee char int;
        value read_int_nz : iteratee char int;
        value read_uint32 : iteratee char int32;
        value read_uint32_nz : iteratee char int32;
        value read_int32 : iteratee char int32;
        value read_int32_nz : iteratee char int32;
        value read_uint64 : iteratee char int64;
        value read_uint64_nz : iteratee char int64;
        value read_int64 : iteratee char int64;
        value read_int64_nz : iteratee char int64;
      end;
    value read_uint : iteratee char int;
    value read_uint_nz : iteratee char int;
    value read_int : iteratee char int;
    value read_int_nz : iteratee char int;
    value read_uint32 : iteratee char int32;
    value read_uint32_nz : iteratee char int32;
    value read_int32 : iteratee char int32;
    value read_int32_nz : iteratee char int32;
    value read_uint64 : iteratee char int64;
    value read_uint64_nz : iteratee char int64;
    value read_int64 : iteratee char int64;
    value read_int64_nz : iteratee char int64;
    module type NUM =
      sig
        type num;
        value num_of_int : int -> num;
        value mult_num : num -> num -> num;
        value power_num : num -> num -> num;
        value num_of_string : string -> num;
      end;
    module Reading_num :
      functor (Num : NUM) ->
        sig
          value num_fix_unsigned : iteratee char Num.num;
          value num_fix : iteratee char Num.num;
          value num_of_string_fix : string -> It_IO.m Num.num;
        end;
    module Base64 :
      sig
        value base64_conv_table : string;
        exception Bad_encoding;
        value base64_decode_char : char -> int;
        value base64_decode_piece :
          ~ibuf:array int -> ~arr_to:array char -> ~arr_ofs:int -> unit;
        value base64_decode :
          ~s_from:S.t char ->
          ~arr_to:array char ->
          ~ibuf:array int -> ~ipos:ref int -> (int * bool * bool);
        value base64_decode_last :
          ~arr_to:array char ->
          ~ibuf:array int -> ~ipos_val:int -> (int * bool);
        value enee_cont :
          iteratee 'a 'b ->
          ((stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) ->
           iteratee 'c (iteratee 'a 'b)) ->
          iteratee 'c (iteratee 'a 'b);
        value enee_cont_io :
          iteratee 'a 'b ->
          ((stream 'a -> It_IO.m (iteratee 'a 'b * sl 'a)) ->
           It_IO.m (iteratee 'c (iteratee 'a 'b) * sl 'c)) ->
          It_IO.m (iteratee 'c (iteratee 'a 'b) * sl 'c);
        value enee_base64_decode :
          iteratee char 'a -> iteratee char (iteratee char 'a);
        value step :
          array int ->
          ref int ->
          ref (array char) ->
          (stream char -> It_IO.m (iteratee char 'a * sl char)) ->
          stream char -> It_IO.m (iteratee char (iteratee char 'a) * sl char);
        value finish :
          ~obuf:ref (array char) ->
          ~ibuf:array int ->
          ~ipos:ref int ->
          ~opt_err:option err_msg ->
          (stream char -> It_IO.m (iteratee char 'a * sl char)) ->
          It_IO.m (iteratee char (iteratee char 'a) * sl char);
        value pass_obuf :
          ~written:int ->
          ~arr_to:array char ->
          (stream char -> It_IO.m (iteratee char 'a * sl char)) ->
          It_IO.m (iteratee char 'a);
        value ret :
          ~opt_err:option err_msg ->
          (stream char -> It_IO.m (iteratee char 'a * sl char)) ->
          It_IO.m (iteratee char (iteratee char 'a) * sl char);
      end;
    value base64_decode :
      iteratee char 'a -> iteratee char (iteratee char 'a);
    module Deque_stream :
      sig
        type t 'a;
        value empty : t 'a;
        value cons : int -> stream 'a -> t 'a -> t 'a;
        value cons_sl : sl 'a -> t 'a -> t 'a;
        value snoc : t 'a -> int -> stream 'a -> t 'a;
        value concat : t 'a -> sl 'a;
        value destr_head : t 'a -> option ((int * stream 'a) * t 'a);
        value is_empty : t 'a -> bool;
      end;
    value fdbg : format4 'a unit string unit -> 'a;
    value break_subsequence :
      (S.t 'a -> int -> option (It_IO.m (iteratee 'a 'b * sl 'a))) ->
      iteratee 'a 'c -> iteratee 'a (option 'b * iteratee 'a 'c);
    value it_ignore : iteratee 'a unit;
    value it_ignore_step : stream 'a -> It_IO.m (iteratee 'a unit * sl 'a);
    value map_ready : iteratee 'a 'b -> iteratee 'c 'b;
    value eof_to_res :
      iteratee 'a 'b ->
      option err_msg -> iteratee 'c [= `Error of err_msg | `Ok of 'b ];
    value probe_string :
      string ->
      S.t char -> int -> option (It_IO.m (iteratee char unit * sl char));
    value it_last : int -> iteratee 'a (list 'a);
  end
;