ocaml-iteratees /

(* +
   The [place] type represents the place where exception
   was raised.  For now, it's a name of IO function returned
   an error.

type place = string;

(* +
   IO exception, carrying the real IO exception and the place
   (usually function name) where it was raised.

exception EIO of (exn * place);

(* +
   Sometimes it's more convenient to have an IO result wrapped
   in value with type [res 'a], than having to [IO.catch] errors.
   See function [mres] in functor.

type res +'a = [= `Ok of 'a | `Error of exn ]

(* +
   This is a signature for IO monad.  These functions and types are used
   by Iteratees functor.  It's possible that your implementation of IO
   have much more functions than MonadIO, so you should not restrict
   your IO implementation by this MonadIO signature.

module type MonadIO
    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;  (* Lwt_io.close inch *)
    value read_into : input_channel -> string -> int -> int -> m int;
       (* in lwt: read_into ic buffer offset length *)

    value runIO : m 'a -> [= `Ok of 'a | `Error of exn ];

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.