annotate src/core_util.sig @ 619:f38e009009bb

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