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 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 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 : stream 'a -> 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;
    type iteratee 'a 'b =

        [ IE_done of 'b
        | IE_cont of option err_msg and
            stream 'a -> It_IO.m (iteratee 'a 'b * stream '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 * stream 'a);
    value throw_recoverable_err :
      err_msg ->
      (stream 'a -> It_IO.m (iteratee 'a 'b * stream '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 * stream 'b);
    value ie_contM :
      (stream 'a -> It_IO.m (iteratee 'a 'b * stream 'a)) ->
      It_IO.m (iteratee 'a 'b * stream 'c);
    value ie_cont :
      (stream 'a -> It_IO.m (iteratee 'a 'b * stream '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 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 : 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_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 : int -> enumeratee 'a '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;
    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 * stream '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 * stream 'a)) ->
      stream 'a -> It_IO.m (iteratee 'a 'b);
    value base64_decode : enumeratee char char 'a;
  end
;