annotate src/flat_util.sig @ 26:4ab19c19665f

Closure conversion
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Jun 2008 15:56:33 -0400
parents
children 104d43266b33
rev   line source
adamc@26 1 (* Copyright (c) 2008, Adam Chlipala
adamc@26 2 * All rights reserved.
adamc@26 3 *
adamc@26 4 * Redistribution and use in source and binary forms, with or without
adamc@26 5 * modification, are permitted provided that the following conditions are met:
adamc@26 6 *
adamc@26 7 * - Redistributions of source code must retain the above copyright notice,
adamc@26 8 * this list of conditions and the following disclaimer.
adamc@26 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@26 10 * this list of conditions and the following disclaimer in the documentation
adamc@26 11 * and/or other materials provided with the distribution.
adamc@26 12 * - The names of contributors may not be used to endorse or promote products
adamc@26 13 * derived from this software without specific prior written permission.
adamc@26 14 *
adamc@26 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@26 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@26 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@26 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@26 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@26 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@26 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@26 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@26 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@26 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@26 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@26 26 *)
adamc@26 27
adamc@26 28 signature FLAT_UTIL = sig
adamc@26 29
adamc@26 30 structure Typ : sig
adamc@26 31 val mapfold : (Flat.typ', 'state, 'abort) Search.mapfolder
adamc@26 32 -> (Flat.typ, 'state, 'abort) Search.mapfolder
adamc@26 33
adamc@26 34 val map : (Flat.typ' -> Flat.typ')
adamc@26 35 -> Flat.typ -> Flat.typ
adamc@26 36
adamc@26 37 val fold : (Flat.typ' * 'state -> 'state)
adamc@26 38 -> 'state -> Flat.typ -> 'state
adamc@26 39
adamc@26 40 val exists : (Flat.typ' -> bool) -> Flat.typ -> bool
adamc@26 41 end
adamc@26 42
adamc@26 43 structure Exp : sig
adamc@26 44 datatype binder =
adamc@26 45 NamedT of string * int * Flat.typ option
adamc@26 46 | RelE of string * Flat.typ
adamc@26 47 | NamedE of string * int * Flat.typ * Flat.exp option
adamc@26 48
adamc@26 49 val mapfoldB : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 50 exp : ('typtext, Flat.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 51 bind : 'typtext * binder -> 'typtext}
adamc@26 52 -> ('typtext, Flat.exp, 'state, 'abort) Search.mapfolderB
adamc@26 53 val mapfold : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 54 exp : (Flat.exp', 'state, 'abort) Search.mapfolder}
adamc@26 55 -> (Flat.exp, 'state, 'abort) Search.mapfolder
adamc@26 56
adamc@26 57 val map : {typ : Flat.typ' -> Flat.typ',
adamc@26 58 exp : Flat.exp' -> Flat.exp'}
adamc@26 59 -> Flat.exp -> Flat.exp
adamc@26 60 val mapB : {typ : Flat.typ' -> Flat.typ',
adamc@26 61 exp : 'typtext -> Flat.exp' -> Flat.exp',
adamc@26 62 bind : 'typtext * binder -> 'typtext}
adamc@26 63 -> 'typtext -> (Flat.exp -> Flat.exp)
adamc@26 64
adamc@26 65 val fold : {typ : Flat.typ' * 'state -> 'state,
adamc@26 66 exp : Flat.exp' * 'state -> 'state}
adamc@26 67 -> 'state -> Flat.exp -> 'state
adamc@26 68
adamc@26 69 val exists : {typ : Flat.typ' -> bool,
adamc@26 70 exp : Flat.exp' -> bool} -> Flat.exp -> bool
adamc@26 71 end
adamc@26 72
adamc@26 73 structure Decl : sig
adamc@26 74 datatype binder = datatype Exp.binder
adamc@26 75
adamc@26 76 val mapfoldB : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 77 exp : ('typtext, Flat.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 78 decl : ('typtext, Flat.decl', 'state, 'abort) Search.mapfolderB,
adamc@26 79 bind : 'typtext * binder -> 'typtext}
adamc@26 80 -> ('typtext, Flat.decl, 'state, 'abort) Search.mapfolderB
adamc@26 81 val mapfold : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 82 exp : (Flat.exp', 'state, 'abort) Search.mapfolder,
adamc@26 83 decl : (Flat.decl', 'state, 'abort) Search.mapfolder}
adamc@26 84 -> (Flat.decl, 'state, 'abort) Search.mapfolder
adamc@26 85
adamc@26 86 val fold : {typ : Flat.typ' * 'state -> 'state,
adamc@26 87 exp : Flat.exp' * 'state -> 'state,
adamc@26 88 decl : Flat.decl' * 'state -> 'state}
adamc@26 89 -> 'state -> Flat.decl -> 'state
adamc@26 90 end
adamc@26 91
adamc@26 92 structure File : sig
adamc@26 93 datatype binder =
adamc@26 94 NamedT of string * int * Flat.typ option
adamc@26 95 | RelE of string * Flat.typ
adamc@26 96 | NamedE of string * int * Flat.typ * Flat.exp option
adamc@26 97 | F of int * string * Flat.typ * Flat.typ * Flat.exp
adamc@26 98
adamc@26 99 val mapfoldB : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 100 exp : ('typtext, Flat.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 101 decl : ('typtext, Flat.decl', 'state, 'abort) Search.mapfolderB,
adamc@26 102 bind : 'typtext * binder -> 'typtext}
adamc@26 103 -> ('typtext, Flat.file, 'state, 'abort) Search.mapfolderB
adamc@26 104
adamc@26 105 val mapfold : {typ : (Flat.typ', 'state, 'abort) Search.mapfolder,
adamc@26 106 exp : (Flat.exp', 'state, 'abort) Search.mapfolder,
adamc@26 107 decl : (Flat.decl', 'state, 'abort) Search.mapfolder}
adamc@26 108 -> (Flat.file, 'state, 'abort) Search.mapfolder
adamc@26 109
adamc@26 110 val mapB : {typ : Flat.typ' -> Flat.typ',
adamc@26 111 exp : 'typtext -> Flat.exp' -> Flat.exp',
adamc@26 112 decl : 'typtext -> Flat.decl' -> Flat.decl',
adamc@26 113 bind : 'typtext * binder -> 'typtext}
adamc@26 114 -> 'typtext -> Flat.file -> Flat.file
adamc@26 115
adamc@26 116 val fold : {typ : Flat.typ' * 'state -> 'state,
adamc@26 117 exp : Flat.exp' * 'state -> 'state,
adamc@26 118 decl : Flat.decl' * 'state -> 'state}
adamc@26 119 -> 'state -> Flat.file -> 'state
adamc@26 120 end
adamc@26 121
adamc@26 122 end