diff options
| author | Thomas Bauereiss | 2017-12-19 11:53:23 +0000 |
|---|---|---|
| committer | Thomas Bauereiss | 2017-12-19 12:03:48 +0000 |
| commit | b938fd99a9f16d4bb2ef1c483574a2850aa6e640 (patch) | |
| tree | 0e160767d304677005c06222a28a574792257f4f /src/process_file.ml | |
| parent | 5c0b807f89b99b1f7adb2a2f6aebdea52a8bdd80 (diff) | |
Support user-defined exceptions in Lem shallow embedding
The type-checker already supports a user-defined "exception" type that can be
used in throw and try-catch expressions. This patch adds support for that to
the Lem shallow embedding by adapting the existing exception mechanisms of the
state and prompt monads. User-defined exceptions are distinguished from
builtin exception cases. For example, the state monad uses
type ex 'e =
| Exit
| Assert of string
| Throw of 'e
to distinguish between calls to "exit", failed assertions, and user-defined
exceptions, respectively. Early return is also handled using the exception
mechanism, by lifting to a monad with "either 'r exception" as the exception
type, where 'r is the expected return type and "exception" is the user-defined
exception type.
Diffstat (limited to 'src/process_file.ml')
0 files changed, 0 insertions, 0 deletions
