Module Io


module Io: sig .. end
Rudimentary I/O-monad


IO-Monad



Types



type error =
| EndOfFile (*Tried to read beyond end of file*)
| IntOfString (*Could not convert string to int*)
| SysError of string (*Operating system signaled an error. The string takes the precise reason.*)
Possible errors during an IO-operation. They are named after their imperative counterparts.
type world 
The imperative, "outside" world the functional IO-monad deals with.
type ('a, 'b) either 
type 'a t = world -> (error, 'a) either * world 
An IO-monad of type 'a takes the current world and produces either a correct value (of type 'a or an error and a new world.
val __conjure_up : unit -> world
val bind : 'a t -> ('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val throw : error -> 'a t
val catch : 'a t -> (error -> 'a t) -> 'a t
val print_char : char -> unit t
val print_string : string -> unit t
val print_int : int -> unit t
val print_float : float -> unit t
val print_endline : string -> unit t
val print_newline : unit -> unit t
val prerr_char : char -> unit t
val prerr_string : string -> unit t
val prerr_int : int -> unit t
val prerr_float : float -> unit t
val prerr_endline : string -> unit t
val prerr_newline : unit -> unit t
val read_line : unit -> string t
val read_int : unit -> int t
val read_float : unit -> float t
val open_out : string -> Pervasives.out_channel t
val output_char : Pervasives.out_channel -> char -> unit t
val output_string : Pervasives.out_channel -> string -> unit t
val close_out : Pervasives.out_channel -> unit t