[MLton-commit] r5398
Vesa Karvonen
vesak at mlton.org
Mon Mar 5 22:53:21 PST 2007
Introducing some more structure into the library interface and
implementation.
----------------------------------------------------------------------
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/exit.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/exn.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/with.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/emb.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exit.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exn.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fix.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/emb.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/fix.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/iso.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/tie.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/iso.sml
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/lazy/
A mltonlib/trunk/com/ssh/extended-basis/unstable/detail/lazy/promise.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/promise.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/sigs.cm
U mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/unsealed.cm
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/text-io.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/tie.sml
D mltonlib/trunk/com/ssh/extended-basis/unstable/detail/with.sml
U mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/exit.sig
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/exn.sig
A mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/with.sig
D mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/exn.sig
D mltonlib/trunk/com/ssh/extended-basis/unstable/public/exit.sig
D mltonlib/trunk/com/ssh/extended-basis/unstable/public/with.sig
----------------------------------------------------------------------
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/exit.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exit.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/exn.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exn.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/control/with.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/with.sml)
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/emb.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/emb.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/emb.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,19 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Emb :> EMB = struct
- open Emb
-
- infix <-->
-
- val id = (Fn.id, SOME)
-
- val to = Pair.fst
- val from = Pair.snd
-
- fun (a2b, b2aOpt) <--> (c2a, a2cOpt) =
- (a2b o c2a, Option.composePartial (a2cOpt, b2aOpt))
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exit.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exit.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exit.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,20 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Exit :> EXIT = struct
- type 'a t = 'a -> exn
-
- fun within block = let
- exception EscapedExit of 'a
- in
- block EscapedExit
- handle EscapedExit value => value
- end
-
- fun to exit value = raise exit value
-
- fun call block = within (block o to)
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exn.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exn.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/exn.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,16 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Exn : EXN = struct
- open Exn Ext.Exn
- val name = BasisGeneral.exnName
- val message = BasisGeneral.exnMessage
- fun apply f x = Sum.INR (f x) handle e => Sum.INL e
- fun eval th = apply th ()
- fun throw e = raise e
- fun try (th, fv, fe) = Sum.sum (fe, fv) (eval th)
- fun finally (th, ef) = try (th, Effect.past ef, throw o Effect.past ef)
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fix.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fix.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fix.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,10 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Fix :> FIX = struct
- open Fix
- exception Fix
-end
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/emb.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/emb.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/fix.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/fix.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/iso.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/iso.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/generic/tie.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/tie.sml)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/io/text-io.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/text-io.sml)
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/iso.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/iso.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/iso.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,29 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Iso :> ISO = struct
- open Iso
-
- infix <-->
-
- val id = (Fn.id, Fn.id)
-
- val to = Pair.fst
- val from = Pair.snd
- val swap = Pair.swap
-
- fun (a2b, b2a) <--> (c2a, a2c) = (a2b o c2a, a2c o b2a)
-
- fun map (l, r) iso = r <--> iso <--> l
-
- local
- fun mk map = Pair.map map o Pair.swizzle
- in
- fun op --> ? = mk (Fn.map, Fn.map) ?
- fun op +` ? = mk (Sum.map, Sum.map) ?
- fun op *` ? = mk (Product.map, Product.map) ?
- end
-end
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/lazy/promise.sml (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/detail/promise.sml)
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/promise.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/promise.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/promise.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,44 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Promise :> PROMISE = struct
- datatype 'a status = LAZY of 'a t Thunk.t
- | EAGER of (Exn.t, 'a) Sum.t
- withtype 'a t = 'a status ref ref
-
- fun lazy th = ref (ref (LAZY th))
- fun eager x = ref (ref (EAGER (Sum.INR x)))
- fun delay th = lazy (ref o ref o EAGER o (fn () => Exn.eval th))
-
- fun replay s = Sum.sum (Exn.throw, Fn.id) s
-
- fun force promise =
- case !(!promise) of
- EAGER x => replay x
- | LAZY th => let
- val promise' = th ()
- in
- case !(!promise) of
- LAZY _ => (!promise := !(!promise')
- ; promise := !promise'
- ; force promise)
- | EAGER x => replay x
- end
-
- fun toThunk promise =
- case !(!promise) of
- EAGER s => Sum.sum (Basic.raising, Fn.const) s
- | LAZY _ => fn () => force promise
-
- fun tie s k =
- case !(!s) of
- EAGER _ => raise Fix.Fix
- | LAZY _ => s := !k
-
- fun Y ? =
- Tie.tier (fn () => Pair.map (Fn.id, tie)
- (Sq.mk (lazy (Basic.raising Fix.Fix)))) ?
-end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/sigs.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/sigs.cm 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/sigs.cm 2007-03-06 06:53:19 UTC (rev 5398)
@@ -21,8 +21,10 @@
../../public/concept/scannable.sig
../../public/concept/signed.sig
../../public/concept/stringable.sig
+ ../../public/control/exit.sig
+ ../../public/control/exn.sig
+ ../../public/control/with.sig
../../public/data/bool.sig
- ../../public/data/exn.sig
../../public/data/option.sig
../../public/data/order.sig
../../public/data/pair.sig
@@ -33,7 +35,6 @@
../../public/data/sum.sig
../../public/data/unit.sig
../../public/data/univ.sig
- ../../public/exit.sig
../../public/fn/bin-fn.sig
../../public/fn/bin-op.sig
../../public/fn/bin-pr.sig
@@ -69,6 +70,5 @@
../../public/text/substring.sig
../../public/text/text.sig
../../public/void.sig
- ../../public/with.sig
../../public/writer.sig
bootstrap.cm
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/unsealed.cm
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/unsealed.cm 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/smlnj/unsealed.cm 2007-03-06 06:53:19 UTC (rev 5398)
@@ -27,13 +27,17 @@
../../detail/concept/mk-scannable.fun
../../detail/concept/mk-stringable.fun
../../detail/concept/mk-word-flags.fun
+ ../../detail/control/exit.sml
+ ../../detail/control/exn.sml
+ ../../detail/control/with.sml
../../detail/effect.sml
- ../../detail/emb.sml
- ../../detail/exit.sml
- ../../detail/exn.sml
- ../../detail/fix.sml
../../detail/fn.sml
- ../../detail/iso.sml
+ ../../detail/generic/emb.sml
+ ../../detail/generic/fix.sml
+ ../../detail/generic/iso.sml
+ ../../detail/generic/tie.sml
+ ../../detail/io/text-io.sml
+ ../../detail/lazy/promise.sml
../../detail/list.sml
../../detail/mk-int-inf-ext.fun
../../detail/mk-integer-ext.fun
@@ -50,7 +54,6 @@
../../detail/order.sml
../../detail/pair.sml
../../detail/product.sml
- ../../detail/promise.sml
../../detail/reader.sml
../../detail/ref.sml
../../detail/smlnj/ints.sml
@@ -62,15 +65,12 @@
../../detail/smlnj/words.sml
../../detail/sq.sml
../../detail/sum.sml
- ../../detail/text-io.sml
../../detail/thunk.sml
- ../../detail/tie.sml
../../detail/un-op.sml
../../detail/un-pr.sml
../../detail/univ-exn.sml
../../detail/vector-slice.sml
../../detail/vector.sml
- ../../detail/with.sml
../../detail/writer.sml
../../public/lazy/promise.sig
ext.sml
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/text-io.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/text-io.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/text-io.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,12 +0,0 @@
-(* Copyright (C) 2007 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure TextIO = struct
- open BasisTextIO
-
- fun println s =
- (output (stdOut, s) ; output1 (stdOut, #"\n") ; flushOut stdOut)
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/tie.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/tie.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/tie.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,23 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure Tie :> TIE = struct
- type 'a t_dom = Unit.t
- type 'a t_cod = 'a * 'a UnOp.t
- type 'a t = 'a t_dom -> 'a t_cod
- fun fix a f = let val (a, ta) = a () in ta (f a) end
- val pure = Fn.id
- fun tier th = (fn (a, ta) => (a, Fn.const a o ta)) o th
- fun iso tb iso = Pair.map (Iso.from iso, Fn.map iso) o tb
- fun op *` (a, b) = Pair.map (Product.&, Product.map) o
- Pair.swizzle o Pair.map (a, b) o Sq.mk
- fun tuple2 (a, b) = iso (op *` (a, b)) Product.isoTuple2
- fun option () = (NONE, Fn.id)
- fun fromRef rf x = !rf x
- fun function ? =
- tier (fn () => Pair.map (fromRef, Fn.curry op :=)
- (Sq.mk (ref (Basic.raising Fix.Fix)))) ?
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/detail/with.sml
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/detail/with.sml 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/detail/with.sml 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,40 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-structure With :> WITH = struct
- type 'a t = 'a Effect.t Effect.t
-
- infix >>=
-
- structure Monad =
- MkMonad (type 'a monad = 'a t
- val return = Fn.pass
- fun (aM >>= a2bM) f = aM (fn a => a2bM a f))
-
- open Monad
-
- val lift = Fn.id
- val for = Fn.id
- fun one aM f = let
- val result = ref NONE
- in
- aM (fn a => result := SOME (f a)) : Unit.t
- ; valOf (!result)
- end
-
- fun alloc g a f = f (g a)
- fun free ef x f = (f x handle e => (ef x ; raise e)) before ef x
-
- fun around new del = alloc new () >>= free del
- fun entry ef = alloc ef ()
- fun exit ef = free ef ()
- local
- fun `f x () = f x
- in
- fun calling {entry, exit} v = around (`entry v) (`exit v)
- fun passing ef {entry, exit} = around (`ef entry) (`ef exit)
- end
-end
Modified: mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/extensions.mlb 2007-03-06 06:53:19 UTC (rev 5398)
@@ -123,7 +123,7 @@
(* Fix *)
public/generic/fix.sig
- detail/fix.sml
+ detail/generic/fix.sml
(* UnPr *)
public/fn/un-pr.sig
@@ -163,28 +163,28 @@
detail/concept/mk-monad.fun
(* With *)
- public/with.sig
- detail/with.sml
+ public/control/with.sig
+ detail/control/with.sml
(* Sum *)
public/data/sum.sig
detail/sum.sml
(* Exn *)
- public/data/exn.sig
- detail/exn.sml
+ public/control/exn.sig
+ detail/control/exn.sml
(* Emb *)
public/generic/emb.sig
- detail/emb.sml
+ detail/generic/emb.sml
(* Iso *)
public/generic/iso.sig
- detail/iso.sml
+ detail/generic/iso.sml
(* Tie *)
public/generic/tie.sig
- detail/tie.sml
+ detail/generic/tie.sml
(* Seqs *)
public/sequence/array.sig
@@ -218,8 +218,8 @@
detail/writer.sml
(* Exit *)
- public/exit.sig
- detail/exit.sml
+ public/control/exit.sig
+ detail/control/exit.sml
(* Scalars *)
public/numeric/int-inf.sig
@@ -259,14 +259,14 @@
(* Promise *)
public/lazy/promise.sig
- detail/promise.sml
+ detail/lazy/promise.sml
(* ShiftOp *)
public/fn/shift-op.sig
(* TextIO *)
public/io/text-io.sig
- detail/text-io.sml
+ detail/io/text-io.sml
(* MkWordFlags *)
detail/concept/mk-word-flags.fun
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/exit.sig (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/public/exit.sig)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/exn.sig (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/exn.sig)
Copied: mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/with.sig (from rev 5393, mltonlib/trunk/com/ssh/extended-basis/unstable/public/with.sig)
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/exn.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/exn.sig 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/data/exn.sig 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,58 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-(** Utilities for dealing with exceptions. *)
-signature EXN = sig
- type t = exn
- (** Convenience alias. *)
-
- (** == Exception Handling == *)
-
- val apply : ('a -> 'b) -> 'a -> (t, 'b) Sum.t
- (** Perform an application ({apply f x = INR (f x) handle e => INL e}). *)
-
- val eval : 'a Thunk.t -> (t, 'a) Sum.t
- (** Evaluate a thunk ({eval th = INR (th ()) handle e => INL e}). *)
-
- val finally : 'a Thunk.t * Unit.t Effect.t -> 'a
- (** {finally (th, ef) = try (th, past ef, throw o past ef)}. *)
-
- val throw : t -> 'a
- (** Raise exception ({throw exn = raise exn}). *)
-
- val try : 'a Thunk.t * ('a -> 'b) * (t -> 'b) -> 'b
- (**
- * Try-in-unless ({try (th, fv, fe) = sum (fv, fe) (eval th)}). {try}
- * facilitates fine control over exception handling. {try} implements
- * the try-in-unless construct of Benton and Kennedy.
- *)
-
- (** == Examining Exceptions == *)
-
- val addMessager : (t -> String.t Option.t) Effect.t
- (**
- * Adds a pretty-printer to be used by {message} for converting
- * exceptions to strings. Messagers are tried in order from most
- * recently added to least recently added.
- *)
-
- val message : t -> String.t
- (** Same as {General.exnMessage}. *)
-
- val name : t -> String.t
- (** Same as {General.exnName}. *)
-
- val history : t -> String.t List.t
- (**
- * Returns call stack at the point that the exception was first raised.
- * Each element of the list is a file position. The elements are in
- * reverse chronological order, i.e. the function called last is at the
- * front of the list.
- *
- * {history} will likely return {[]} unless the program is compiled
- * with a compiler dependent option to support exception history.
- *)
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/public/exit.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/exit.sig 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/exit.sig 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,56 +0,0 @@
-(* Copyright (C) 2006 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-(**
- * Signature for exit (or escape) handlers.
- *
- * Note that the implementation necessarily uses exception handling. This
- * is to make proper resource handling possible. Exceptions raised by the
- * implementation can be caught by wildcard exception handlers. Wildcard
- * exception handlers should generally reraise exceptions after performing
- * their effects.
- *)
-signature EXIT = sig
- type 'a t
- (** The type of exits. *)
-
- val within : ('a t -> 'a) -> 'a
- (**
- * Sets up an exit and passes it to the given function. The function
- * may then return normally or by calling {to} with the exit and a
- * return value. For example,
- *
- *> Exit.within
- *> (fn l =>
- *> if condition then
- *> Exit.to l 1
- *> else
- *> 2)
- *
- * evaluates either to {1} or to {2} depending on the {condition}.
- *
- * Note that the function receiving the exit is called from a non-tail
- * position.
- *)
-
- val to : 'a t -> 'a -> 'b
- (**
- * {to l v} returns from the {within} invocation that introduced the
- * exit {l} with the value {v}. Evaluating {to l v} outside of the
- * {within} invocation that introduced {l} is a programming error and
- * raises an exception.
- *
- * Note that the type variable {'b} only appears as the return type.
- * This means that {to} doesn't return normally to the caller and can
- * be called from a context of any type.
- *)
-
- val call : (('a -> 'b) -> 'a) -> 'a
- (**
- * Simpler, but less flexibly typed, interface to {within} and {to}.
- * Specifically, {call f} is equivalent to {within (f o to)}.
- *)
-end
Deleted: mltonlib/trunk/com/ssh/extended-basis/unstable/public/with.sig
===================================================================
--- mltonlib/trunk/com/ssh/extended-basis/unstable/public/with.sig 2007-03-06 06:37:06 UTC (rev 5397)
+++ mltonlib/trunk/com/ssh/extended-basis/unstable/public/with.sig 2007-03-06 06:53:19 UTC (rev 5398)
@@ -1,87 +0,0 @@
-(* Copyright (C) 2006-2007 SSH Communications Security, Helsinki, Finland
- *
- * This code is released under the MLton license, a BSD-style license.
- * See the LICENSE file or http://mlton.org/License for details.
- *)
-
-(** Scoped resource management combinators. *)
-signature WITH = sig
- type 'a t
-
- (** == Monad Interface == *)
-
- include MONAD_CORE where type 'a monad = 'a t
-
- structure Monad : MONAD where type 'a monad = 'a t
-
- (** === Lifting Ad Hoc SRM Combinators === *)
-
- val lift : 'a Effect.t Effect.t -> 'a t
- (** Lifts an arbitrary SRM combinator to the monad. *)
-
- (** === Running With === *)
-
- val for : 'a t -> 'a Effect.t Effect.t
- (**
- * Runs the monad and passes the value to the effect block. This may
- * be more efficient than {one}.
- *)
-
- val one : 'a t -> ('a -> 'b) -> 'b
- (**
- * Runs the monad and passes the value to the given block. The result
- * of the block is then returned. If the result is {()} then it is
- * better to use {for}.
- *)
-
- (** == Primitives == *)
-
- val alloc : ('a -> 'b) -> 'a -> 'b t
- (**
- * Apply the given function with the given value just before entry to
- * the block.
- *
- * This is basically a lazy version of {return}. Specifically, {alloc
- * g a} is equivalent to {fn f => f (g a)}, assuming {g} and {a} are
- * variables.
- *)
-
- val free : 'a Effect.t -> 'a -> 'a t
- (**
- * Performs the effect with the given value after exit from the block.
- * This is basically a variation of {finally}. Specifically, {free ef
- * x f} is equivalent to {finally (fn () => f x, fn () => ef x)}.
- *)
-
- (** == Useful Combinations == *)
-
- val around : 'a Thunk.t -> 'a Effect.t -> 'a t
- (**
- * Allocate resources with given thunk before entry to the block and
- * release the resource with given effect after exit from the block.
- * {around new del} is equivalent to {alloc new () >>= free del}.
- *)
-
- val entry : Unit.t Effect.t -> Unit.t t
- (**
- * Perform given effect before entry to the block.
- *
- * Note that the identifier {before} is already used in the Standard ML
- * Basis Library.
- *)
-
- val exit : Unit.t Effect.t -> Unit.t t
- (** Perform given effect after exit from the block. *)
-
- val calling : {entry : 'a Effect.t, exit : 'a Effect.t} -> 'a -> Unit.t t
- (**
- * Call given effects with the given value before entry to and after
- * exit from the block.
- *)
-
- val passing : 'a Effect.t -> {entry : 'a, exit : 'a} -> Unit.t t
- (**
- * Call given effect with a given values before entry to and after exit
- * from the block.
- *)
-end
More information about the MLton-commit
mailing list