[MLton-commit] r5833
Vesa Karvonen
vesak at mlton.org
Wed Aug 8 01:31:29 PDT 2007
Added mapState to Reader and Writer.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/reader.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/writer.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/reader.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/writer.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/reader.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/reader.sml 2007-08-07 19:09:19 UTC (rev 5832)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/reader.sml 2007-08-08 08:31:28 UTC (rev 5833)
@@ -7,6 +7,8 @@
structure Reader :> READER = struct
open Reader
+ fun mapState (s2t, t2s) = Fn.map (s2t, Option.map (Pair.map (Fn.id, t2s)))
+
infix >>= <|>
type 'a monad_dom = Univ.t and 'a monad_cod = ('a * Univ.t) Option.t
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/writer.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/writer.sml 2007-08-07 19:09:19 UTC (rev 5832)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/writer.sml 2007-08-08 08:31:28 UTC (rev 5833)
@@ -7,6 +7,8 @@
structure Writer :> WRITER = struct
open Writer
+ fun mapState (s2t, t2s) = Fn.map (Pair.map (Fn.id, s2t), t2s)
+
type 'a func_dom = 'a * Univ.t and 'a func_cod = Univ.t
type 'a func = 'a func_dom -> 'a func_cod
fun map b2a wA = wA o Pair.map (b2a, Fn.id)
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/reader.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/reader.sig 2007-08-07 19:09:19 UTC (rev 5832)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/reader.sig 2007-08-08 08:31:28 UTC (rev 5833)
@@ -8,6 +8,8 @@
signature READER = sig
type ('a, 's) t = 's -> ('a * 's) Option.t
+ val mapState : ('s, 't) Iso.t -> ('a, 't) t -> ('a, 's) t
+
(** == Monad Interface == *)
type 'a monad_dom and 'a monad_cod
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/writer.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/writer.sig 2007-08-07 19:09:19 UTC (rev 5832)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/io/writer.sig 2007-08-08 08:31:28 UTC (rev 5833)
@@ -8,6 +8,8 @@
signature WRITER = sig
type ('a, 's) t = 'a * 's -> 's
+ val mapState : ('s, 't) Iso.t -> ('a, 't) t -> ('a, 's) t
+
(** == Functor Interface == *)
type 'a func_dom and 'a func_cod
More information about the MLton-commit
mailing list