Source

planck / lib / pbase.mli

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

open Spotlib.Spot

module type S = sig

  module Str : Stream_intf.S
  type error = Str.Pos.t * string
  type 'a t = Str.t -> ('a * Str.t, error) Result.t
  val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t

  include Planck_intf.S with module Str := Str and type 'a t := 'a t and type error := error

end

module Make( Str : Stream_intf.S ) : S with module Str = Str
(** 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].
*)