std.io

Functions for working with I/O

Types

type File = File

Values

let functor : std.functor.Functor IO

A Functor represents an action on a parameterized type which does not change the structure with the mapped type.

The following laws should hold:

  • map id == id
  • map (f << g) == map f << map g

let applicative : std.applicative.Applicative IO

A Functor with application.

The following laws should hold:

  • wrap id <*> v = v
  • wrap (<<) <> u <> v <> w = u <> (v <*> w)
  • wrap f <*> wrap x = wrap (f x)
  • u <> wrap y = wrap (\g -> g x) <> u

let monad : std.monad.Monad IO

A generalised interface for imperatively sequencing actions

let flat_map : forall b a . (a -> IO b) -> IO a -> IO b

let wrap : forall a . a -> IO a

let open_file : String -> IO File

let read_file : File -> Int -> IO (Array Byte)

let read_file_to_string : String -> IO String

let read_file_to_array : String -> IO (Array Byte)

let read_char : IO Char

let read_line : IO String

let print : String -> IO ()

let println : String -> IO ()

let flush_stdout : IO ()

let eprint : String -> IO ()

let eprintln : String -> IO ()

let catch : forall a . IO a -> (String -> IO a) -> IO a

let run_expr : String -> IO { value : String, typ : String }

let load_script : String -> String -> IO String