annotate src/elab_util.sig @ 627:f4f2b09a533a

demo/sum working with manual folders
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Feb 2009 17:39:55 -0500
parents 588b9d16b00a
children 7292bcb7c02d
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@6 65 val exists : {kind : Elab.kind' -> bool,
adamc@6 66 con : Elab.con' -> bool} -> Elab.con -> bool
adamc@448 67
adamc@623 68 val foldB : {kind : 'context * Elab.kind' * 'state -> 'state,
adamc@448 69 con : 'context * Elab.con' * 'state -> 'state,
adamc@448 70 bind : 'context * binder -> 'context}
adamc@448 71 -> 'context -> 'state -> Elab.con -> 'state
adamc@6 72 end
adamc@6 73
adamc@10 74 structure Exp : sig
adamc@11 75 datatype binder =
adamc@623 76 RelK of string
adamc@623 77 | RelC of string * Elab.kind
adamc@329 78 | NamedC of string * int * Elab.kind
adamc@11 79 | RelE of string * Elab.con
adamc@11 80 | NamedE of string * Elab.con
adamc@11 81
adamc@623 82 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@11 83 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@11 84 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@11 85 bind : 'context * binder -> 'context}
adamc@11 86 -> ('context, Elab.exp, 'state, 'abort) Search.mapfolderB
adamc@10 87 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@10 88 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@10 89 exp : (Elab.exp', 'state, 'abort) Search.mapfolder}
adamc@10 90 -> (Elab.exp, 'state, 'abort) Search.mapfolder
adamc@623 91 val mapB : {kind : 'context -> Elab.kind' -> Elab.kind',
adamc@211 92 con : 'context -> Elab.con' -> Elab.con',
adamc@211 93 exp : 'context -> Elab.exp' -> Elab.exp',
adamc@211 94 bind : 'context * binder -> 'context}
adamc@211 95 -> 'context -> (Elab.exp -> Elab.exp)
adamc@10 96 val exists : {kind : Elab.kind' -> bool,
adamc@10 97 con : Elab.con' -> bool,
adamc@10 98 exp : Elab.exp' -> bool} -> Elab.exp -> bool
adamc@448 99
adamc@623 100 val foldB : {kind : 'context * Elab.kind' * 'state -> 'state,
adamc@448 101 con : 'context * Elab.con' * 'state -> 'state,
adamc@448 102 exp : 'context * Elab.exp' * 'state -> 'state,
adamc@448 103 bind : 'context * binder -> 'context}
adamc@448 104 -> 'context -> 'state -> Elab.exp -> 'state
adamc@10 105 end
adamc@10 106
adamc@34 107 structure Sgn : sig
adamc@34 108 datatype binder =
adamc@623 109 RelK of string
adamc@623 110 | RelC of string * Elab.kind
adamc@329 111 | NamedC of string * int * Elab.kind
adamc@34 112 | Str of string * Elab.sgn
adamc@59 113 | Sgn of string * Elab.sgn
adamc@34 114
adamc@623 115 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@34 116 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@34 117 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@34 118 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@34 119 bind : 'context * binder -> 'context}
adamc@34 120 -> ('context, Elab.sgn, 'state, 'abort) Search.mapfolderB
adamc@34 121
adamc@34 122
adamc@34 123 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@34 124 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@34 125 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@34 126 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder}
adamc@34 127 -> (Elab.sgn, 'state, 'abort) Search.mapfolder
adamc@34 128
adamc@34 129 val map : {kind : Elab.kind' -> Elab.kind',
adamc@34 130 con : Elab.con' -> Elab.con',
adamc@34 131 sgn_item : Elab.sgn_item' -> Elab.sgn_item',
adamc@34 132 sgn : Elab.sgn' -> Elab.sgn'}
adamc@34 133 -> Elab.sgn -> Elab.sgn
adamc@34 134
adamc@2 135 end
adamc@34 136
adamc@76 137 structure Decl : sig
adamc@76 138 datatype binder =
adamc@623 139 RelK of string
adamc@623 140 | RelC of string * Elab.kind
adamc@329 141 | NamedC of string * int * Elab.kind
adamc@76 142 | RelE of string * Elab.con
adamc@76 143 | NamedE of string * Elab.con
adamc@76 144 | Str of string * Elab.sgn
adamc@76 145 | Sgn of string * Elab.sgn
adamc@76 146
adamc@623 147 val mapfoldB : {kind : ('context, Elab.kind', 'state, 'abort) Search.mapfolderB,
adamc@76 148 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@76 149 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@76 150 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@76 151 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@76 152 str : ('context, Elab.str', 'state, 'abort) Search.mapfolderB,
adamc@76 153 decl : ('context, Elab.decl', 'state, 'abort) Search.mapfolderB,
adamc@76 154 bind : 'context * binder -> 'context}
adamc@76 155 -> ('context, Elab.decl, 'state, 'abort) Search.mapfolderB
adamc@76 156 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@76 157 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@76 158 exp : (Elab.exp', 'state, 'abort) Search.mapfolder,
adamc@76 159 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@76 160 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder,
adamc@76 161 str : (Elab.str', 'state, 'abort) Search.mapfolder,
adamc@76 162 decl : (Elab.decl', 'state, 'abort) Search.mapfolder}
adamc@76 163 -> (Elab.decl, 'state, 'abort) Search.mapfolder
adamc@76 164 val exists : {kind : Elab.kind' -> bool,
adamc@76 165 con : Elab.con' -> bool,
adamc@76 166 exp : Elab.exp' -> bool,
adamc@76 167 sgn_item : Elab.sgn_item' -> bool,
adamc@76 168 sgn : Elab.sgn' -> bool,
adamc@76 169 str : Elab.str' -> bool,
adamc@76 170 decl : Elab.decl' -> bool}
adamc@76 171 -> Elab.decl -> bool
adamc@76 172 val search : {kind : Elab.kind' -> 'a option,
adamc@76 173 con : Elab.con' -> 'a option,
adamc@76 174 exp : Elab.exp' -> 'a option,
adamc@76 175 sgn_item : Elab.sgn_item' -> 'a option,
adamc@76 176 sgn : Elab.sgn' -> 'a option,
adamc@76 177 str : Elab.str' -> 'a option,
adamc@76 178 decl : Elab.decl' -> 'a option}
adamc@76 179 -> Elab.decl -> 'a option
adamc@448 180
adamc@623 181 val foldMapB : {kind : 'context * Elab.kind' * 'state -> Elab.kind' * 'state,
adamc@448 182 con : 'context * Elab.con' * 'state -> Elab.con' * 'state,
adamc@448 183 exp : 'context * Elab.exp' * 'state -> Elab.exp' * 'state,
adamc@448 184 sgn_item : 'context * Elab.sgn_item' * 'state -> Elab.sgn_item' * 'state,
adamc@448 185 sgn : 'context * Elab.sgn' * 'state -> Elab.sgn' * 'state,
adamc@448 186 str : 'context * Elab.str' * 'state -> Elab.str' * 'state,
adamc@448 187 decl : 'context * Elab.decl' * 'state -> Elab.decl' * 'state,
adamc@448 188 bind : 'context * binder -> 'context}
adamc@448 189 -> 'context -> 'state -> Elab.decl -> Elab.decl * 'state
adamc@448 190 end
adamc@448 191
adamc@448 192 structure File : sig
adamc@448 193 val maxName : Elab.file -> int
adamc@34 194 end
adamc@76 195
adamc@76 196 end