Source

oni / cf / cf_dyn.mli

Full commit
(*---------------------------------------------------------------------------*
  $Change$
  Copyright (C) 2011, james woodyatt
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:
  
    Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
    
    Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  OF THE POSSIBILITY OF SUCH DAMAGE. 
 *---------------------------------------------------------------------------*)

type ('i, 'o) t = ('i, 'o) s Lazy.t and ('i, 'o) s =
    | Z
    | P of 'o * ('i, 'o) t
    | Q of ('i -> ('i, 'o) s)

val fin: ('i, 'o) t

val nop: ('a, 'a) t
val select: ('a option, 'a) t
val flat: ('a Cf_seq.t, 'a) t

val filter: ('a -> bool) -> ('a, 'a) t
val map: ('i -> 'o) -> ('i, 'o) t
val fold: ('r -> 'o -> 'r) -> ('r -> 'i * 'r) -> 'r -> ('i, 'o) t -> 'r

val connect: ('a, 'b) t -> ('b, 'c) t -> ('a, 'c) t
val cyclical: ('i, 'o) t -> ('i, 'o) t

val sequential: ('a, 'b) t Cf_seq.t -> ('a, 'b) t
val concurrent: ('a, 'b) t Cf_seq.t -> ('a, 'b) t

val copy: ('i, 'o) t -> ('i, 'o * 'o) t
val fuse: ('i, 'a) t -> ('i, 'b) t -> ('i, 'a * 'b) t

module A: sig
    val tag: ('a, ('a, 'b) Cf_either.t) t
    val strip: (('a, 'b) Cf_either.t, 'a) t
end

module B: sig
    val tag: ('b, ('a, 'b) Cf_either.t) t
    val strip: (('a, 'b) Cf_either.t, 'b) t
end

val commute: ('i, 'o) t -> 'i Cf_seq.t -> 'o Cf_seq.t
val drain: ('i, 'o) t -> 'o Cf_seq.t
val flush: ('i, 'o) t -> ('i, 'o) t

val stringcommute: (char, char) t -> string -> string
val upcase: (char, char) t
val dncase: (char, char) t

val liftseq: 'o Cf_seq.t -> ('i, 'o) t
val downseq: (unit, 'o) t -> 'o Cf_seq.t

module CM: sig
    val eval: (('i, 'o) t, unit) Cf_cmonad.t -> ('i, 'o) t
    val read: (('i, 'o) t, 'i) Cf_cmonad.t
    val write: 'o -> (('i, 'o) t, unit) Cf_cmonad.t
end

module SCM: sig
    val eval: ('s, ('i, 'o) t, unit) Cf_scmonad.t -> 's -> ('i, 'o) t
    val read: ('s, ('i, 'o) t, 'i) Cf_scmonad.t
    val write: 'o -> ('s, ('i, 'o) t, unit) Cf_scmonad.t
end

module Op: sig
    val ( -=- ): ('a, 'b) t -> ('b, 'c) t -> ('a, 'c) t
    val ( ~& ): ('i, 'o) t list -> ('i, 'o) t
    val ( ~* ): ('i, 'o) t list -> ('i, 'o) t
end

(*--- $File$ ---*)