3.3 Delivery tools: the Deliver structure

with_delivery_hook

Function

Summary

Adds a user-customized delivery function to a list of hooks that will be executed during delivery.

Signature

MLWORKS.Deliver

Structure

MLWorks.Deliver

Type

val with_delivery_hook: delivery_hook -> ('a -> 'b) -> 'a -> 'b

Syntax

with_delivery_hook hook f x

Arguments

hook
A user-customized delivery function of type delivery_hook.

f
An ML function.

x
Arguments to f.

Description

Adds a user-customized delivery function, hook, to a list of hooks that will be executed during delivery whenever the deliver function is called during the application of f to x. Note that hooks are executed in the order they were added: if h1 is added first, it will be executed first.

Example

The following example defines a hook that catches a failed delivery:

MLWorks> fun hello () = print "Hello, world.\n";
val hello : unit -> unit = fn

MLWorks> fun deliver_hello () = MLWorks.Deliver.deliver("hello", hello, true); val deliver_hello : unit -> unit = fn

MLWorks> MLWorks.Deliver.with_delivery_hook (fn f => fn x => f x handle _ => print "Delivery failed\n") deliver_hello (); val it : unit = () MLWorks>


MLWorks Reference Manual (version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker