module type S =sig
..end
AnyShtream.Make
.
The shtream and coshtream types in the resulting module are
compatible with other applications of the functor and with Shtream
.
When AnyShtream.Make
is applied to a structure Elem
(having
signature AnyShtream.ELEM
), the resulting module knows how to write
shtreams of type 'a Elem.elem Shtream.t
and read shtreams of type
Elem.initial Elem.elem Shtream.t
. Functions in the resulting
module take several optional parameters whose defaults are
supplied by Elem
:
?(reader : in_channel -> initial elem)
defaults to
Elem.reader ()
.?(parse : string -> initial elem)
defaults to Elem.of_string ()
.?(show : 'a elem -> string)
defaults to Elem.string_of ()
.include Shtream.COMMON
with type 'a t = 'a Shtream.t
and type 'a co_t = 'a Shtream.co_t
AnyShtream.Make
contains all the type-indifferent
shtream operations from Shtream
.module Elem:AnyShtream.ELEM
type'a
elem ='a Elem.elem
AnyShtream.ELEM.elem
typeinitial =
Elem.initial
AnyShtream.ELEM.initial
val elem_reader : Reader.t -> Pervasives.in_channel -> initial elem
initial elem
reader from a record reader.
Functions such as AnyShtream.S.of_channel
and AnyShtream.S.of_program
take a function
of the type returned here.val output : ?channel:Pervasives.out_channel ->
?init:('a elem -> string) ->
?term:('a elem -> string) ->
?show:('a elem -> string) -> 'a elem t -> unit
x
of the shtream, it prints init x
, then
show x
, and then term x
on the channel, and then flushes the
channel.
channel
: default = stdout
init
: default = fun _ -> ""
term
: default = fun _ -> "\n"
show
: default = Elem.string_of ()
val channel_of : ?procref:Channel.procref ->
?before:(unit -> unit) ->
?after:(unit -> unit) ->
?init:('a elem -> string) ->
?term:('a elem -> string) ->
?show:('a elem -> string) ->
'a elem t -> Pervasives.in_channel
in_channel
from the data in a
shtream. If forking a child is necessary (see
Shtream.channel_of
), then the optional
parameter ?before
(resp. ?after
) is called in the child
before (resp. after) printing the shtream; anything printed on
stdout
by ?before
(?after
) appears in the resultant
in_channel
before (after) the shtream data.
The remaining arguments are as for AnyShtream.S.output
.
val string_list_of : ?show:('a elem -> string) ->
'a elem t -> string list
?show
.val string_stream_of : ?show:('a elem -> string) ->
'a elem t -> string Stream.t
Stream.t
of
strings, using ?show
.val of_channel : ?reader:(Pervasives.in_channel -> initial elem) ->
Pervasives.in_channel -> initial elem t
?reader
.val of_file : ?reader:(Pervasives.in_channel -> initial elem) ->
string -> initial elem t
?reader
.val of_command : ?procref:Channel.procref ->
?dups:Channel.dup_spec ->
?reader:(Pervasives.in_channel -> initial elem) ->
string -> initial elem t
?reader
.
If ?procref
is given, stash the Proc.t
; if ?dups
is given, perform the dups in the child process.val of_program : ?procref:Channel.procref ->
?dups:Channel.dup_spec ->
?reader:(Pervasives.in_channel -> initial elem) ->
?path:bool ->
string ->
?argv0:string -> string list -> initial elem t
?reader
.
If ?procref
is given, stash the Proc.t
; if ?dups
is given, perform the dups in the child process.val of_thunk : ?procref:Channel.procref ->
?dups:Channel.dup_spec ->
?reader:(Pervasives.in_channel -> initial elem) ->
(unit -> unit) -> initial elem t
?reader
.
If ?procref
is given, stash the Proc.t
; if ?dups
is given, perform the dups in the child process.val of_string_list : ?parse:(string -> initial elem) ->
string list -> initial elem t
?parse
.val of_string_stream : ?parse:(string -> initial elem) ->
string Stream.t -> initial elem t
Stream.t
of strings, using ?parse
.