[MLton-commit] r5868

Vesa Karvonen vesak at mlton.org
Mon Aug 13 23:25:33 PDT 2007


Added toString to BUFFER.
----------------------------------------------------------------------

U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/common/basis.sml
U   mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-buffer-common.fun
U   mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig

----------------------------------------------------------------------

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml	2007-08-14 06:23:58 UTC (rev 5867)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/bootstrap.sml	2007-08-14 06:25:33 UTC (rev 5868)
@@ -17,6 +17,7 @@
    fun isTrue b = b = true
 end
 structure Char = struct open BasisChar type t = char end
+structure CharVector = struct open BasisCharVector type t = vector end
 structure Option = struct open BasisOption type 'a t = 'a option end
 structure String = struct open BasisString type t = string end
 structure Int = struct open BasisInt type t = int end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/common/basis.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/common/basis.sml	2007-08-14 06:23:58 UTC (rev 5867)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/ml/common/basis.sml	2007-08-14 06:25:33 UTC (rev 5868)
@@ -82,6 +82,7 @@
 structure BasisBool = Bool
 structure BasisByte = Byte
 structure BasisChar = Char
+structure BasisCharVector = CharVector
 structure BasisCommandLine = CommandLine
 structure BasisDate = Date
 structure BasisGeneral = General
@@ -106,6 +107,7 @@
 structure BasisSocket = Socket
 structure BasisString = String
 structure BasisStringCvt = StringCvt
+structure BasisSubstring = Substring
 structure BasisText = Text
 structure BasisTextIO = TextIO
 structure BasisTime = Time

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-buffer-common.fun
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-buffer-common.fun	2007-08-14 06:23:58 UTC (rev 5867)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/sequence/mk-buffer-common.fun	2007-08-14 06:25:33 UTC (rev 5868)
@@ -5,10 +5,11 @@
  *)
 
 functor MkBufferCommon (type 'a elem
-                        val inj : 'a -> 'a elem
-                        val prj : 'a elem -> 'a
-                        val any : 'a -> 'a elem) = struct
-   structure A=Array and AS=ArraySlice and V=Vector and VS=VectorSlice and L=List
+                            val inj : 'a -> 'a elem
+                            val prj : 'a elem -> 'a
+                            val any : 'a -> 'a elem) = struct
+   structure A=Array and AS=ArraySlice and L=List and CV=CharVector and V=Vector
+         and VS=VectorSlice
    datatype 'a t = T of {array : 'a elem A.t Ref.t, length : Int.t Ref.t}
 
    fun the s (T r) = s r
@@ -81,8 +82,9 @@
    local
       fun to tabulate t = tabulate (length t, prj o asub (array t))
    in
-      fun toArray ? = to A.tabulate ?
-      fun toList ? = to L.tabulate ?
-      fun toVector ? = to V.tabulate ?
+      fun toArray  ? = to  A.tabulate ?
+      fun toList   ? = to  L.tabulate ?
+      fun toVector ? = to  V.tabulate ?
+      fun toString ? = to CV.tabulate ?
    end
 end

Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig	2007-08-14 06:23:58 UTC (rev 5867)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/sequence/buffer.sig	2007-08-14 06:25:33 UTC (rev 5868)
@@ -83,6 +83,12 @@
     * equivalent to {List.tabulate (length b, b <\ sub)}.
     *)
 
+   val toString : Char.t t -> String.t
+   (**
+    * Returns the contents of a char buffer as a string.  {toString b} is
+    * equivalent to {String.implode (toList b)}.
+    *)
+
    val toVector : 'a t -> 'a Vector.t
    (**
     * Returns the contents of the buffer as a vector.  {toVector b} is




More information about the MLton-commit mailing list