annotate src/elab_util.sig @ 216:38b299373676

Looking up in a type class from a module
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 Aug 2008 15:58:25 -0400
parents e86411f647c6
children eec65c11d3e2
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@6 33 val mapfold : (Elab.kind', 'state, 'abort) Search.mapfolder
adamc@2 34 -> (Elab.kind, 'state, 'abort) Search.mapfolder
adamc@2 35 val exists : (Elab.kind' -> bool) -> Elab.kind -> bool
adamc@2 36 end
adamc@2 37
adamc@6 38 structure Con : sig
adamc@11 39 datatype binder =
adamc@11 40 Rel of string * Elab.kind
adamc@11 41 | Named of string * Elab.kind
adamc@11 42
adamc@11 43 val mapfoldB : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@11 44 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@11 45 bind : 'context * binder -> 'context}
adamc@11 46 -> ('context, Elab.con, 'state, 'abort) Search.mapfolderB
adamc@6 47 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@10 48 con : (Elab.con', 'state, 'abort) Search.mapfolder}
adamc@6 49 -> (Elab.con, 'state, 'abort) Search.mapfolder
adamc@11 50
adamc@11 51 val mapB : {kind : Elab.kind' -> Elab.kind',
adamc@11 52 con : 'context -> Elab.con' -> Elab.con',
adamc@11 53 bind : 'context * binder -> 'context}
adamc@11 54 -> 'context -> (Elab.con -> Elab.con)
adamc@34 55 val map : {kind : Elab.kind' -> Elab.kind',
adamc@34 56 con : Elab.con' -> Elab.con'}
adamc@34 57 -> Elab.con -> Elab.con
adamc@6 58 val exists : {kind : Elab.kind' -> bool,
adamc@6 59 con : Elab.con' -> bool} -> Elab.con -> bool
adamc@6 60 end
adamc@6 61
adamc@10 62 structure Exp : sig
adamc@11 63 datatype binder =
adamc@11 64 RelC of string * Elab.kind
adamc@11 65 | NamedC of string * Elab.kind
adamc@11 66 | RelE of string * Elab.con
adamc@11 67 | NamedE of string * Elab.con
adamc@11 68
adamc@11 69 val mapfoldB : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@11 70 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@11 71 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@11 72 bind : 'context * binder -> 'context}
adamc@11 73 -> ('context, Elab.exp, 'state, 'abort) Search.mapfolderB
adamc@10 74 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@10 75 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@10 76 exp : (Elab.exp', 'state, 'abort) Search.mapfolder}
adamc@10 77 -> (Elab.exp, 'state, 'abort) Search.mapfolder
adamc@211 78 val mapB : {kind : Elab.kind' -> Elab.kind',
adamc@211 79 con : 'context -> Elab.con' -> Elab.con',
adamc@211 80 exp : 'context -> Elab.exp' -> Elab.exp',
adamc@211 81 bind : 'context * binder -> 'context}
adamc@211 82 -> 'context -> (Elab.exp -> Elab.exp)
adamc@10 83 val exists : {kind : Elab.kind' -> bool,
adamc@10 84 con : Elab.con' -> bool,
adamc@10 85 exp : Elab.exp' -> bool} -> Elab.exp -> bool
adamc@10 86 end
adamc@10 87
adamc@34 88 structure Sgn : sig
adamc@34 89 datatype binder =
adamc@34 90 RelC of string * Elab.kind
adamc@34 91 | NamedC of string * Elab.kind
adamc@34 92 | Str of string * Elab.sgn
adamc@59 93 | Sgn of string * Elab.sgn
adamc@34 94
adamc@34 95 val mapfoldB : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@34 96 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@34 97 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@34 98 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@34 99 bind : 'context * binder -> 'context}
adamc@34 100 -> ('context, Elab.sgn, 'state, 'abort) Search.mapfolderB
adamc@34 101
adamc@34 102
adamc@34 103 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@34 104 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@34 105 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@34 106 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder}
adamc@34 107 -> (Elab.sgn, 'state, 'abort) Search.mapfolder
adamc@34 108
adamc@34 109 val map : {kind : Elab.kind' -> Elab.kind',
adamc@34 110 con : Elab.con' -> Elab.con',
adamc@34 111 sgn_item : Elab.sgn_item' -> Elab.sgn_item',
adamc@34 112 sgn : Elab.sgn' -> Elab.sgn'}
adamc@34 113 -> Elab.sgn -> Elab.sgn
adamc@34 114
adamc@2 115 end
adamc@34 116
adamc@76 117 structure Decl : sig
adamc@76 118 datatype binder =
adamc@76 119 RelC of string * Elab.kind
adamc@76 120 | NamedC of string * Elab.kind
adamc@76 121 | RelE of string * Elab.con
adamc@76 122 | NamedE of string * Elab.con
adamc@76 123 | Str of string * Elab.sgn
adamc@76 124 | Sgn of string * Elab.sgn
adamc@76 125
adamc@76 126 val mapfoldB : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@76 127 con : ('context, Elab.con', 'state, 'abort) Search.mapfolderB,
adamc@76 128 exp : ('context, Elab.exp', 'state, 'abort) Search.mapfolderB,
adamc@76 129 sgn_item : ('context, Elab.sgn_item', 'state, 'abort) Search.mapfolderB,
adamc@76 130 sgn : ('context, Elab.sgn', 'state, 'abort) Search.mapfolderB,
adamc@76 131 str : ('context, Elab.str', 'state, 'abort) Search.mapfolderB,
adamc@76 132 decl : ('context, Elab.decl', 'state, 'abort) Search.mapfolderB,
adamc@76 133 bind : 'context * binder -> 'context}
adamc@76 134 -> ('context, Elab.decl, 'state, 'abort) Search.mapfolderB
adamc@76 135 val mapfold : {kind : (Elab.kind', 'state, 'abort) Search.mapfolder,
adamc@76 136 con : (Elab.con', 'state, 'abort) Search.mapfolder,
adamc@76 137 exp : (Elab.exp', 'state, 'abort) Search.mapfolder,
adamc@76 138 sgn_item : (Elab.sgn_item', 'state, 'abort) Search.mapfolder,
adamc@76 139 sgn : (Elab.sgn', 'state, 'abort) Search.mapfolder,
adamc@76 140 str : (Elab.str', 'state, 'abort) Search.mapfolder,
adamc@76 141 decl : (Elab.decl', 'state, 'abort) Search.mapfolder}
adamc@76 142 -> (Elab.decl, 'state, 'abort) Search.mapfolder
adamc@76 143 val exists : {kind : Elab.kind' -> bool,
adamc@76 144 con : Elab.con' -> bool,
adamc@76 145 exp : Elab.exp' -> bool,
adamc@76 146 sgn_item : Elab.sgn_item' -> bool,
adamc@76 147 sgn : Elab.sgn' -> bool,
adamc@76 148 str : Elab.str' -> bool,
adamc@76 149 decl : Elab.decl' -> bool}
adamc@76 150 -> Elab.decl -> bool
adamc@76 151 val search : {kind : Elab.kind' -> 'a option,
adamc@76 152 con : Elab.con' -> 'a option,
adamc@76 153 exp : Elab.exp' -> 'a option,
adamc@76 154 sgn_item : Elab.sgn_item' -> 'a option,
adamc@76 155 sgn : Elab.sgn' -> 'a option,
adamc@76 156 str : Elab.str' -> 'a option,
adamc@76 157 decl : Elab.decl' -> 'a option}
adamc@76 158 -> Elab.decl -> 'a option
adamc@34 159 end
adamc@76 160
adamc@76 161 end