Commits

camlspotter committed e09dc59

wiped out stupid default values from the base!

  • Participants
  • Parent commits 6134534

Comments (0)

Files changed (6)

 open Spotlib.Spot
 open Result
 
-module Make(Str : Stream_intf.S) = struct
+module Make(Str : sig
+  include Stream_intf.S
+  val default_null : t
+end) = struct
   module Str = Str
 
   type error = Str.Pos.t * string
   abs_pos : Position.File.t; (* from the first of the stream *)
 }
 
-let default_buf = { base = Sstring.default_null;
+let default_buf = { base = Sstring.the_null;
                     buf_pos = -1;
                     rel_pos = -1;
                     abs_pos = Position.File.none }
   module Attr = struct
     type t = Pos.t
     let position x = x
-    let default = Pos.none
   end
   module Elem = struct
     type t = string
   end
 end)
 
-let default_null_desc = null_desc Attr.default
-let default_null = null Attr.default
+let attr_default = ()
 
-let from_string str = Lazy.lazy_from_val (cons_desc str Attr.default default_null)
+let the_null_desc = null_desc attr_default
+let the_null = null attr_default
+
+let from_string str = Lazy.lazy_from_val (cons_desc str attr_default the_null)
 
 let from_chan ic =
   let len = 1024 in
   let rec read () = lazy begin
     let buf = String.create len in
     let read_bytes = input ic buf 0 len in
-    if read_bytes = 0 then default_null_desc
+    if read_bytes = 0 then null_desc attr_default
     else
       let str = String.sub buf 0 read_bytes in
-      cons_desc str Attr.default (read ())
+      cons_desc str attr_default (read ())
   end
   in
   read ()
   with type Elem.t = string
   and  type Pos.t  = unit
 
-val default_null : t
+val the_null_desc : desc
+val the_null : t
 
 val from_string : string -> t
 
   let null_desc attr = Lazylist.Cons ((None, attr), Lazylist.null)
   let null attr = Lazy.lazy_from_val (null_desc attr)
 
-  let default_null = null Attr.default
-
   let desc = desc
   let peek = function
     | lazy Cons ((Some elem, _), t') -> Some (elem, t')

lib/stream_intf.ml

 
   module Attr : sig
     type t
-    val default : t
     val position : t -> Pos.t
   end 
   (** Module for stream positions *)
   val null : Attr.t -> t
   (** Create a null stream *)
 
-  val default_null : t
-  (** The default null with the default position. The position may be just a meaningless value. *)
-
   val null_desc : Attr.t -> desc
   val cons_desc : Elem.t -> Attr.t -> t -> desc
   (** Create a null/cons cell desc. *)