[MLton-commit] r5383
Vesa Karvonen
vesak at mlton.org
Fri Mar 2 03:26:37 PST 2007
Only reveal that the Monad/Functor is a function. This ensures that the
threaded state can not be accessed while making it possible to eta-expand
definitions.
----------------------------------------------------------------------
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/reader.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/writer.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/reader.sig
U mltonlib/trunk/com/ssh/extended-basis/unstable/public/writer.sig
----------------------------------------------------------------------
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/reader.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/reader.sml 2007-03-02 09:40:36 UTC (rev 5382)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/reader.sml 2007-03-02 11:26:36 UTC (rev 5383)
@@ -9,11 +9,11 @@
infix >>=
- type s = Univ.t
+ type 'a monad_d = Univ.t and 'a monad_r = ('a * Univ.t) Option.t
structure Monad =
MkMonadP
- (type 'a monad = ('a, s) Reader.t
+ (type 'a monad = 'a monad_d -> 'a monad_r
fun return a s = SOME (a, s)
fun aM >>= a2bM = Option.mapPartial (Fn.uncurry a2bM) o aM
fun zero _ = NONE
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/writer.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/writer.sml 2007-03-02 09:40:36 UTC (rev 5382)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/writer.sml 2007-03-02 11:26:36 UTC (rev 5383)
@@ -7,9 +7,8 @@
structure Writer :> WRITER = struct
open Writer
- type s = Univ.t
-
- type 'a func = ('a, s) t
+ type 'a func_d = 'a * Univ.t and 'a func_r = Univ.t
+ type 'a func = 'a func_d -> 'a func_r
fun map b2a wA = wA o Pair.map (b2a, Fn.id)
fun polymorphically uA2uB = let
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/reader.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/reader.sig 2007-03-02 09:40:36 UTC (rev 5382)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/reader.sig 2007-03-02 11:26:36 UTC (rev 5383)
@@ -10,9 +10,9 @@
(** == Monad Interface == *)
- type s
- include MONADP_CORE where type 'a monad = ('a, s) t
- structure Monad : MONADP where type 'a monad = ('a, s) t
+ type 'a monad_d and 'a monad_r
+ include MONADP_CORE where type 'a monad = 'a monad_d -> 'a monad_r
+ structure Monad : MONADP where type 'a monad = 'a monad
val polymorphically : ('a monad -> 'b monad) -> ('a, 's) t -> ('b, 's) t
end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/public/writer.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/writer.sig 2007-03-02 09:40:36 UTC (rev 5382)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/writer.sig 2007-03-02 11:26:36 UTC (rev 5383)
@@ -10,8 +10,8 @@
(** == Functor Interface == *)
- type s
- include CFUNC where type 'a func = ('a, s) t
+ type 'a func_d and 'a func_r
+ include CFUNC where type 'a func = 'a func_d -> 'a func_r
val polymorphically : ('a func -> 'b func) -> ('a, 's) t -> ('b, 's) t
end
More information about the MLton-commit
mailing list