annotate src/elab_util.sig @ 782:a44daa674810

Make Effectize more precise
author Adam Chlipala <adamc@hcoop.net>
date Tue, 05 May 2009 10:23:16 -0400
parents 7292bcb7c02d
children d20d6afc1206
rev   line source
adamc@2 1 (* Copyright (c) 2008, Adam Chlipala
adamc@2 2 * All rights reserved.
adamc@2 3 *
adamc@2 4 * Redistribution and use in source and binary forms, with or without
adamc@2 5 * modification, are permitted provided that the following conditions are met:
adamc@2 6 *
adamc@2 7 * - Redistributions of source code must retain the above copyright notice,
adamc@2 8 * this list of conditions and the following disclaimer.
adamc@2 9 * - Redistributions in binary form must reproduce the above copyright notice,
adamc@2 10 * this list of conditions and the following disclaimer in the documentation
adamc@2 11 * and/or other materials provided with the distribution.
adamc@2 12 * - The names of contributors may not be used to endorse or promote products
adamc@2 13 * derived from this software without specific prior written permission.
adamc@2 14 *
adamc@2 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
adamc@2 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
adamc@2 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
adamc@2 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
adamc@2 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
adamc@2 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
adamc@2 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
adamc@2 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
adamc@2 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
adamc@2 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
adamc@2 25 * POSSIBILITY OF SUCH DAMAGE.
adamc@2 26 *)
adamc@2 27
adamc@2 28 signature ELAB_UTIL = sig
adamc@2 29
adamc@198 30 val classifyDatatype : (string * int * 'a option) list -> Elab.datatype_kind
adamc@188 31
adamc@2 32 structure Kind : sig
adamc@623 33 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@623 34 bind : 'context * string -> 'context}
adamc@623 35 -> ('context, Elab.kind, 'state, 'abort) Search.mapfolderB
adamc@6 36 val mapfold : (Elab.kind', 'state, 'abort) Search.mapfolder
adamc@2 37 -> (Elab.kind, 'state, 'abort) Search.mapfolder
adamc@2 38 val exists : (Elab.kind' -> bool) -> Elab.kind -> bool
adamc@623 39 val mapB : {kind : 'context -> Elab.kind' -> Elab.kind',
adamc@623 40 bind : 'context * string -> 'context}
adamc@623 41 -> 'context -> (Elab.kind -> Elab.kind)
adamc@2 42 end
adamc@2 43
adamc@6 44 structure Con : sig
adamc@11 45 datatype binder =
adamc@623 46 RelK of string
adamc@623 47 | RelC of string * Elab.kind
adamc@623 48 | NamedC of string * int * Elab.kind
adamc@11 49
adamc@623 50 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@11 51 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@11 52 bind : 'context * binder -> 'context}
adamc@11 53 -> ('context, Elab.con, 'state, 'abort) Search.mapfolderB
adamc@6 54 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@10 55 con : (Elab.con', 'state, 'abort) Search.mapfolder}
adamc@6 56 -> (Elab.con, 'state, 'abort) Search.mapfolder
adamc@11 57
adamc@623 58 val mapB : {kind : 'context -> Elab.kind' -> Elab.kind',
adamc@11 59 con : 'context -> Elab.con' -> Elab.con',
adamc@11 60 bind : 'context * binder -> 'context}
adamc@11 61 -> 'context -> (Elab.con -> Elab.con)
adamc@34 62 val map : {kind : Elab.kind' -> Elab.kind',
adamc@34 63 con : Elab.con' -> Elab.con'}
adamc@34 64 -> Elab.con -> Elab.con
adamc@711 65 val existsB : {kind : 'context * Elab.kind' -> bool,
adamc@711 66 con : 'context * Elab.con' -> bool,
adamc@711 67 bind : 'context * binder -> 'context}
adamc@711 68 -> 'context -> Elab.con -> bool
adamc@6 69 val exists : {kind : Elab.kind' -> bool,
adamc@6 70 con : Elab.con' -> bool} -> Elab.con -> bool
adamc@448 71
adamc@623 72 val foldB : {kind : 'context * Elab.kind' * 'state -> 'state,
adamc@448 73 con : 'context * Elab.con' * 'state -> 'state,
adamc@448 74 bind : 'context * binder -> 'context}
adamc@448 75 -> 'context -> 'state -> Elab.con -> 'state
adamc@6 76 end
adamc@6 77
adamc@10 78 structure Exp : sig
adamc@11 79 datatype binder =
adamc@623 80 RelK of string
adamc@623 81 | RelC of string * Elab.kind
adamc@329 82 | NamedC of string * int * Elab.kind
adamc@11 83 | RelE of string * Elab.con
adamc@11 84 | NamedE of string * Elab.con
adamc@11 85
adamc@623 86 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@11 87 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@11 88 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@11 89 bind : 'context * binder -> 'context}
adamc@11 90 -> ('context, Elab.exp, 'state, 'abort) Search.mapfolderB
adamc@10 91 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@10 92 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@10 93 exp : (Elab.exp', 'state, 'abort) Search.mapfolder}
adamc@10 94 -> (Elab.exp, 'state, 'abort) Search.mapfolder
adamc@623 95 val mapB : {kind : 'context -> Elab.kind' -> Elab.kind',
adamc@211 96 con : 'context -> Elab.con' -> Elab.con',
adamc@211 97 exp : 'context -> Elab.exp' -> Elab.exp',
adamc@211 98 bind : 'context * binder -> 'context}
adamc@211 99 -> 'context -> (Elab.exp -> Elab.exp)
adamc@10 100 val exists : {kind : Elab.kind' -> bool,
adamc@10 101 con : Elab.con' -> bool,
adamc@10 102 exp : Elab.exp' -> bool} -> Elab.exp -> bool
adamc@448 103
adamc@623 104 val foldB : {kind : 'context * Elab.kind' * 'state -> 'state,
adamc@448 105 con : 'context * Elab.con' * 'state -> 'state,
adamc@448 106 exp : 'context * Elab.exp' * 'state -> 'state,
adamc@448 107 bind : 'context * binder -> 'context}
adamc@448 108 -> 'context -> 'state -> Elab.exp -> 'state
adamc@10 109 end
adamc@10 110
adamc@34 111 structure Sgn : sig
adamc@34 112 datatype binder =
adamc@623 113 RelK of string
adamc@623 114 | RelC of string * Elab.kind
adamc@329 115 | NamedC of string * int * Elab.kind
adamc@34 116 | Str of string * Elab.sgn
adamc@59 117 | Sgn of string * Elab.sgn
adamc@34 118
adamc@623 119 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@34 120 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@34 121 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@34 122 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@34 123 bind : 'context * binder -> 'context}
adamc@34 124 -> ('context, Elab.sgn, 'state, 'abort) Search.mapfolderB
adamc@34 125
adamc@34 126
adamc@34 127 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@34 128 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@34 129 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@34 130 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder}
adamc@34 131 -> (Elab.sgn, 'state, 'abort) Search.mapfolder
adamc@34 132
adamc@34 133 val map : {kind : Elab.kind' -> Elab.kind',
adamc@34 134 con : Elab.con' -> Elab.con',
adamc@34 135 sgn_item : Elab.sgn_item' -> Elab.sgn_item',
adamc@34 136 sgn : Elab.sgn' -> Elab.sgn'}
adamc@34 137 -> Elab.sgn -> Elab.sgn
adamc@34 138
adamc@2 139 end
adamc@34 140
adamc@76 141 structure Decl : sig
adamc@76 142 datatype binder =
adamc@623 143 RelK of string
adamc@623 144 | RelC of string * Elab.kind
adamc@329 145 | NamedC of string * int * Elab.kind
adamc@76 146 | RelE of string * Elab.con
adamc@76 147 | NamedE of string * Elab.con
adamc@76 148 | Str of string * Elab.sgn
adamc@76 149 | Sgn of string * Elab.sgn
adamc@76 150
adamc@623 151 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@76 152 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@76 153 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@76 154 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@76 155 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@76 156 str : ('context, Elab.str', 'state, 'abort) Search.mapfolderB,
adamc@76 157 decl : ('context, Elab.decl', 'state, 'abort) Search.mapfolderB,
adamc@76 158 bind : 'context * binder -> 'context}
adamc@76 159 -> ('context, Elab.decl, 'state, 'abort) Search.mapfolderB
adamc@76 160 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@76 161 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@76 162 exp : (Elab.exp', 'state, 'abort) Search.mapfolder,
adamc@76 163 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@76 164 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder,
adamc@76 165 str : (Elab.str', 'state, 'abort) Search.mapfolder,
adamc@76 166 decl : (Elab.decl', 'state, 'abort) Search.mapfolder}
adamc@76 167 -> (Elab.decl, 'state, 'abort) Search.mapfolder
adamc@76 168 val exists : {kind : Elab.kind' -> bool,
adamc@76 169 con : Elab.con' -> bool,
adamc@76 170 exp : Elab.exp' -> bool,
adamc@76 171 sgn_item : Elab.sgn_item' -> bool,
adamc@76 172 sgn : Elab.sgn' -> bool,
adamc@76 173 str : Elab.str' -> bool,
adamc@76 174 decl : Elab.decl' -> bool}
adamc@76 175 -> Elab.decl -> bool
adamc@76 176 val search : {kind : Elab.kind' -> 'a option,
adamc@76 177 con : Elab.con' -> 'a option,
adamc@76 178 exp : Elab.exp' -> 'a option,
adamc@76 179 sgn_item : Elab.sgn_item' -> 'a option,
adamc@76 180 sgn : Elab.sgn' -> 'a option,
adamc@76 181 str : Elab.str' -> 'a option,
adamc@76 182 decl : Elab.decl' -> 'a option}
adamc@76 183 -> Elab.decl -> 'a option
adamc@448 184
adamc@623 185 val foldMapB : {kind : 'context * Elab.kind' * 'state -> Elab.kind' * 'state,
adamc@448 186 con : 'context * Elab.con' * 'state -> Elab.con' * 'state,
adamc@448 187 exp : 'context * Elab.exp' * 'state -> Elab.exp' * 'state,
adamc@448 188 sgn_item : 'context * Elab.sgn_item' * 'state -> Elab.sgn_item' * 'state,
adamc@448 189 sgn : 'context * Elab.sgn' * 'state -> Elab.sgn' * 'state,
adamc@448 190 str : 'context * Elab.str' * 'state -> Elab.str' * 'state,
adamc@448 191 decl : 'context * Elab.decl' * 'state -> Elab.decl' * 'state,
adamc@448 192 bind : 'context * binder -> 'context}
adamc@448 193 -> 'context -> 'state -> Elab.decl -> Elab.decl * 'state
adamc@448 194 end
adamc@448 195
adamc@448 196 structure File : sig
adamc@448 197 val maxName : Elab.file -> int
adamc@34 198 end
adamc@76 199
adamc@76 200 end