Source

planck / lib / pbase.mli

(** The basic monadic parser module. See Planck_intf.ml for more details *)

module type S = sig
  include Planck_intf.S
(* CR jfuruse: damn it, we cannot restrict signature by components of itself!
      and  type 'a t = Str.t -> ('a * Str.t, error) Result.t
*)
  val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t
end

module Make( Str : Stream_intf.S ) 
  : S with module Str = Str
      and  type 'a t = Str.t -> ('a * Str.t, Str.Pos.t * string (* =error *)) Result.t
(** Functor [Make] takes a stream implementation [S] and create a monadic parser module for [S].
    The monad is a function type [Str.t -> ('a * Str.t, error) Result.t].
*)