Messages Module
signature MESSAGES
structure Messages :> MESSAGES
This module contains functions for issuing informational and error messages.
val messagePP : (unit -> PP.pp list) -> unit
val messageString : (unit -> string list) -> unit
exception Error
val errorPP : (unit -> PP.pp list) -> 'a
val errorString : (unit -> string list) -> 'a
val quiet : (unit -> 'a) -> 'a
exception CannotHappen
val cannotHappen : unit -> 'a
messagePP f
PP.toString to each element of the result of evaluating f(), and then prints the resulting strings in sequence on the standard output, followed by a newline. Multiple strings are combined—separated by blanks—on single lines, when they fit.
messageString f
f(), and then prints the resulting strings in sequence on the standard output, followed by a newline. Multiple strings are combined—separated by blanks—on single lines, when they fit.
exception Error
errorPP f
messagePP f, except that Error is raised after messagePP returns.
errorString f
messageString f, except that Error is raised after messageString returns.
quiet f
f() in such a way that any calls made by f to messagePP, messageString, errorPP and errorString have no effect (and don't even result in the arguments to messagePP, messageString, errorPP and errorString being called). Whatever f() returns is what quiet returns; or if f() raises an exception, this exception is caught and re-raised by quiet. f()must have no side effects except via calls to messagePP, messageString, errorPP and errorString.
exception CannotHappen
cannotHappen.
cannotHappen()
CannotHappen. Used when an expression of some type is needed, but the expression will never be evaluated
Example:
To avoid a nonexaustive match warning message, we could write
fun f nil = Messages.cannotHappen() | f (x :: xs) = (x, xs)if we knew thatfwould never be called with the empty list.
Forlan Version 4.15
Copyright © 2022 Alley Stoughton