ocaml_monad_io / README

      Monadic input-output with OCaml.

    Why?

  There are many possibilities to implement monadic IO with OCaml.
It's very annoying to copy and paste types and implementations
over the projects, but the real reason was the "diamond problem":
two libraries are using almost same implementation, but different
types.

    How?

  There will be type signatures and implementations for monadic
input-output using Lwt and using direct OCaml input-output
(since OCaml type system implements "monad with errors", where
monad that carries 'a is the 'a itself, and errors are propagated
by exceptions).

    Details!

  Module IO_Types contains signatures:

  - IO_Monad -- just return, bind, bind_rev
  - IO_MonadError -- IO_Monad + error, catch
  - IO_Common (functions' signatures that are common to Lwt,
    Direct IO and possible future IO libraries)

  There are no need for signatures of IO_Lwt and IO_Direct, so there are
no its signatures.

  Module implementations:

- IO_Pure -- no Lwt, no -threads, no exceptions handling
- IO_PureError -- IO_Pure + exceptions
- IO_Lwt -- IO via Lwt
- IO_Direct -- IO via OCaml's Pervasives + Unix + Sys + Thread modules

  IO_Lwt and IO_Direct must match all the signatures contained in IO_Types.


    Why "bind_rev"?

  "bind" function has signature "('a -> m 'b) -> m 'a -> m 'b".
Note, that ">>=" is not "bind", and we should name this function
anyhow.  Let's name it "bind_rev".
  But for performance reasons we can't always do
    "let bind_rev m f = bind f m"
  , so it's up to you, how the bind and bind_rev will be implemented:
one using another or independently.
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 ProjectModifiedEvent.java.
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.