Source

dumbstreaming / ds_types.ml

Full commit
module type IO_Type
 =
  sig
    type m +'a;
    value return : 'a -> m 'a;
    value bind_rev : m 'a -> ('a -> m 'b) -> m 'b;
    value error : exn -> m 'a;
    type input_channel;
    value read_into : input_channel -> string -> int -> int -> m int;
    value close_in : input_channel -> m unit;
    type output_channel;
    value write : output_channel -> string -> m unit;
    value flush : output_channel -> m unit;
    value close_out : output_channel -> m unit;
  end
;


module type IT_TYPE
 =
  sig
    module It_IO
     :
      sig
        type m +'a;
        value return : 'a -> m 'a;
        value bind_rev : m 'a -> ('a -> m 'b) -> m 'b;
        value error : exn -> m 'a;
      end
    ;

    type stream 'el;
    value empty_stream : stream 'el;
    value chunk_of : 'el -> stream 'el;

    type err_msg = exn;

    type iteratee 'el 'a =
      [ IE_done of 'a
      | IE_cont of option err_msg and
          ( stream 'el
            -> It_IO.m (iteratee 'el 'a * stream 'el)
          )
      ]
    ;

    value return : 'a -> iteratee 'el 'a
    ;

    value throw_err : err_msg -> iteratee 'el 'a
    ;

    value peek : iteratee 'el (option 'el)
    ;

    value bindI :
      ('a -> iteratee 'el 'b) -> iteratee 'el 'a -> iteratee 'el 'b
    ;

    value joinI :
      iteratee 'el (iteratee 'el' 'a) -> iteratee 'el 'a
    ;

    value lift : It_IO.m 'a -> iteratee 'el 'a
    ;

    value liftI : It_IO.m (iteratee 'el 'a) -> iteratee 'el 'a
    ;

    value drop : int -> iteratee 'el unit
    ;

    value drop_while : ('el -> bool) -> iteratee 'el unit
    ;

    value break_chars : (char -> bool) -> iteratee char string
    ;

    type enumeratee 'elo 'eli 'a = 
      iteratee 'eli 'a -> iteratee 'elo (iteratee 'eli 'a)
    ;

    value limit : int -> enumeratee 'el 'el 'a
    ;

    value sequence_stream : iteratee 'elo 'eli
      -> enumeratee 'elo 'eli 'a
    ;

    value catch :
      (unit -> iteratee 'el 'a) ->
      ( err_msg ->
         iteratee 'el 'a
      ) ->
      iteratee 'el 'a
    ;

    value take : int -> enumeratee 'el 'el 'a
    ;

    value stream2list : iteratee 'el (list 'el)
    ;

    value run : iteratee 'el 'a -> It_IO.m 'a
    ;

    value feedI :
      (stream 'el -> It_IO.m (iteratee 'el 'a  *  stream 'el)) ->
      stream 'el ->
      It_IO.m (iteratee 'el 'a)
    ;

    value itlist_anyresult_lasterror :
      list (iteratee 'a 'b) -> iteratee 'a 'b
    ;

    value junk : iteratee 'el unit
    ;

    value read_uint : iteratee char int
    ;

    value read_uint64 : iteratee char int64
    ;

    module Ops
     :
      sig
        (* IO binds: *)
        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;

        (* Iteratees binds: *)
        value ( =<< ) :
        ('a -> iteratee 'el 'b) -> iteratee 'el 'a -> iteratee 'el 'b;
        value ( >>= ) :
          iteratee 'el 'a -> ('a -> iteratee 'el 'b) -> iteratee 'el 'b;

        (* Enumerators sequence: *)
(*
        value ( >>> ) :
          enumerator 'el 'a -> enumerator 'el 'a -> enumerator 'el 'a
        ;
*)

      end
    ;

  end
;