Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
BuiltinArrows.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
(******************************************************************************) (* *) (* Monolith *) (* *) (* François Pottier *) (* *) (* Copyright Inria. All rights reserved. This file is distributed under the *) (* terms of the GNU Lesser General Public License as published by the Free *) (* Software Foundation, either version 3 of the License, or (at your *) (* option) any later version, as described in the file LICENSE. *) (* *) (******************************************************************************) open Spec open BuiltinExn open Support (* -------------------------------------------------------------------------- *) (* The nondeterministic arrow combinator. *) let (^?>) domain codomain = domain ^> nondet codomain (* -------------------------------------------------------------------------- *) (* A handler that catches all exceptions, introducing a [result] constructor. *) let (^!>) domain codomain = map_into Exn.handle Exn.Handle.code (domain ^> result codomain exn) (* -------------------------------------------------------------------------- *) (* A handler that catches all exceptions, introducing a [result] constructor, and inserts a [nondet] combinator so that the candidate implementation is allowed to choose whether it wishes to raise an exception. The reference implementation gets access to the candidate's result, which has type [('c, exn) result], and is expected to return its own result at type [('r, exn) result diagnostic]. *) (* The reference implementation is not expected to raise an exception, which is why it is not wrapped with [handle]. *) let id x = x let (^!?>) domain codomain = map_into id Exn.Handle.code (domain ^> nondet (result codomain exn))