Module Basic_monad.Make
The Make
functor is used to create a module with reader and writer functions using the IO monad.
Parameters
Signature
The Make
functor is used to create a module with reader and writer functions using the IO monad. This has the signature
module type IO = sig
type 'a t
val return : 'a -> 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
end
include Jsonxt__.Reader_monad.Reader_monad with type json := Basic.Compliance.json and module IO := IO
module IO : Jsonxt__.Io.IO
val read_json : ?stream:bool -> reader:(Stdlib.Bytes.t -> int -> int IO.t) -> unit -> (json, string) Stdlib.result IO.t
read_json
takes areader
function and returns ajson
value or an error if the string has syntax, grammar or compliance errors. Thereader buf len
parameter reads at mostlen
bytes intobuf
and returns the number of bytes read. Zero indicates end of file. The optionalstream
parameter specifies if multiplejson
objects are to be read, defaulting tofalse
include Jsonxt__.Writer_monad_intf.Intf with type json := Basic.Compliance.json and module IO := IO
module IO : Jsonxt__.Io.IO
val json_writer : writer:(string -> unit IO.t) -> eol:string -> incr:int -> psep:string -> json -> unit IO.t
json_writer ~writer ~eol ~incr ~psep json
convertsjson
to a strings
and writes it out using thewriter string
function.incr
,eol
andpsep
work together to output human readable output.incr
defines the increase in indentation,eol
the end of line sequence andpsep
the string to seperate the : from the value in objectsThe
writer string
function takes a string and returns aunit IO.t