Commits

camlspotter committed 3529074

cleanup

Comments (0)

Files changed (5)

 open Spotlib.Spot
 open Result
 
-module Make(Str : Stream_intf.S) = struct
+module Make(Str : Stream_intf.S) : sig
+
+  type error = Str.Pos.t * string
+  exception Critical_error of error
+
+  type 'a t = Str.t -> ('a * Str.t, error) Result.t
+  (* CR jfuruse: Damn, we must expose the implementation, 
+     for recursive definitions of 'a t
+  *)
+
+  include Planck_intf.S 
+    with module Str = Str
+    with type 'a t := 'a t 
+    with type error := error
+
+  val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t
+
+end = struct
   module Str = Str
 
   type error = Str.Pos.t * string
 (** The basic monadic parser module. See Planck_intf.ml for more details *)
 
-module Make( S : Stream_intf.S ) : Planck_intf.S
-  with type Str.Elem.t = S.Elem.t
-  and  type Str.Pos.t  = S.Pos.t
-  and  type Str.Attr.t = S.Attr.t
-  and  type 'a t = S.t -> ('a * S.t, S.Pos.t * string) Result.t
+module Make( S : Stream_intf.S ) : sig
+  include Planck_intf.S
+    with module Str = S
+  val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t
+end
 (** Functor [Make] takes a stream implementation [S] and create a monadic parser module for [S].
     The parse uses the element, position and attribute from [S].
     The monad is a function type [S.t -> ('a * S.t, S.Pos.t * string) Result.t].

lib/planck_intf.ml

 
 open Spotlib.Spot
 
-(** Profiling purpose to count closure constructions. *)
-module type Profile = sig
-  val incr : unit -> unit
-  val format : Format.t -> unit
-  val reset : unit -> unit
-  val recover_all : unit -> unit (* format will print the over all result *)
-end
-
 module type S = sig
   module Str : Stream_intf.S
   (** Underlied stream *)
 
   (** Monad runner *)
 
-  val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t
-  (** Run the monad over the stream *)
-  (* CR jfuruse: run should be out of S ? *)
+  (* val run : 'a t -> Str.t -> ('a * Str.t, error) Result.t *)
+  (* This is no longer unique, so dropped *)  
 end
+open Spotlib.Spot
+val start : unit -> unit
+val stop : unit -> int
 val incr : unit -> unit
+val add : int -> unit
 val format : Format.t -> unit
 val reset : unit -> unit
 val recover_all : unit -> unit (* format will print the over all result *)
+val wasted : int ref
 open Result
 
 module Make(Str : Stream_intf.S)(State : sig type t end) : sig
-  include Planck_intf.S
+
+  type error = Str.Pos.t * string
+
+  type 'a t = Str.t -> State.t -> ('a * Str.t * State.t, Str.Pos.t * string) Result.t
+  (* CR jfuruse: Damn, we must expose the definition for the recursive definitions! *)
+
+  include Planck_intf.S 
+    with module Str = Str
+    and  type 'a t := 'a t
+    and  type error := error
+
   val get : State.t t
   val put : State.t -> unit t
-  (** do not use [run]. *)
-  val run_with_state : 'a t -> Str.t -> State.t -> ('a * Str.t * State.t, Str.Pos.t * string) Result.t
+
+  val run : 'a t -> Str.t -> State.t -> ('a * Str.t * State.t, Str.Pos.t * string) Result.t
+
 end = struct
   module Str = Str
   module State = State