[MLton-commit] r6324

Vesa Karvonen vesak at mlton.org
Sun Jan 13 12:38:59 PST 2008


Added missing file.

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

A   mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml

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

Added: mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml
===================================================================
--- mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-13 20:29:53 UTC (rev 6323)
+++ mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml	2008-01-13 20:38:59 UTC (rev 6324)
@@ -0,0 +1,33 @@
+(* Copyright (C) 2008 Vesa Karvonen
+ *
+ * This code is released under the MLton license, a BSD-style license.
+ * See the LICENSE file or http://mlton.org/License for details.
+ *)
+
+signature SEQUENCE = sig
+   type t
+   structure Elem : T
+   structure Pos : T
+   val pos : t -> Pos.t
+   val get : (Elem.t, t) Reader.t
+end
+
+structure StringSequence :> sig
+   include SEQUENCE
+      where type Pos.t = Int.t
+      where type Elem.t = Char.t
+   val full : String.t -> t
+   val string : t -> String.t
+end = struct
+   structure Pos = Int
+   structure Elem = Char
+   type t = {pos : Pos.t, data : String.t}
+   fun full s : t = {pos = 0, data = s}
+   val pos : t -> Pos.t = #pos
+   val string : t -> String.t = #data
+   val get : (Elem.t, t) Reader.t =
+    fn {pos, data} =>
+       if pos < size data
+       then SOME (String.sub (data, pos), {pos = pos+1, data = data})
+       else NONE
+end


Property changes on: mltonlib/trunk/com/ssh/generic/unstable/detail/util/sequence.sml
___________________________________________________________________
Name: svn:eol-style
   + native




More information about the MLton-commit mailing list