annotate src/mono_util.sig @ 2160:72fe1cc704c5

Tag NULLs with their types in SQL, to help the DBMS do type inference
author Adam Chlipala <adam@chlipala.net>
date Sat, 04 Jul 2015 19:24:26 -0400
parents 8958b580d026
children f7113855f3b7
rev   line source
adam@1847 1 (* Copyright (c) 2008, 2013, 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 MONO_UTIL = sig
adamc@26 29
adamc@26 30 structure Typ : sig
adamc@109 31 val compare : Mono.typ * Mono.typ -> order
adamc@109 32 val sortFields : (string * Mono.typ) list -> (string * Mono.typ) list
adamc@109 33
adamc@26 34 val mapfold : (Mono.typ', 'state, 'abort) Search.mapfolder
adamc@26 35 -> (Mono.typ, 'state, 'abort) Search.mapfolder
adamc@26 36
adamc@26 37 val map : (Mono.typ' -> Mono.typ')
adamc@26 38 -> Mono.typ -> Mono.typ
adamc@26 39
adamc@26 40 val fold : (Mono.typ' * 'state -> 'state)
adamc@26 41 -> 'state -> Mono.typ -> 'state
adamc@26 42
adamc@26 43 val exists : (Mono.typ' -> bool) -> Mono.typ -> bool
adamc@26 44 end
adamc@26 45
adamc@26 46 structure Exp : sig
adamc@26 47 datatype binder =
adamc@168 48 Datatype of string * int * (string * int * Mono.typ option) list
adamc@26 49 | RelE of string * Mono.typ
adamc@109 50 | NamedE of string * int * Mono.typ * Mono.exp option * string
adamc@26 51
adamc@26 52 val mapfoldB : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 53 exp : ('typtext, Mono.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 54 bind : 'typtext * binder -> 'typtext}
adamc@26 55 -> ('typtext, Mono.exp, 'state, 'abort) Search.mapfolderB
adamc@26 56 val mapfold : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 57 exp : (Mono.exp', 'state, 'abort) Search.mapfolder}
adamc@26 58 -> (Mono.exp, 'state, 'abort) Search.mapfolder
adamc@26 59
adamc@26 60 val map : {typ : Mono.typ' -> Mono.typ',
adamc@26 61 exp : Mono.exp' -> Mono.exp'}
adamc@26 62 -> Mono.exp -> Mono.exp
adamc@26 63 val mapB : {typ : Mono.typ' -> Mono.typ',
adamc@26 64 exp : 'typtext -> Mono.exp' -> Mono.exp',
adamc@26 65 bind : 'typtext * binder -> 'typtext}
adamc@26 66 -> 'typtext -> (Mono.exp -> Mono.exp)
adamc@26 67
adamc@26 68 val fold : {typ : Mono.typ' * 'state -> 'state,
adamc@26 69 exp : Mono.exp' * 'state -> 'state}
adamc@26 70 -> 'state -> Mono.exp -> 'state
adamc@26 71
adamc@26 72 val exists : {typ : Mono.typ' -> bool,
adamc@26 73 exp : Mono.exp' -> bool} -> Mono.exp -> bool
adamc@567 74
adamc@919 75 val existsB : {typ : Mono.typ' -> bool,
adamc@919 76 exp : 'context * Mono.exp' -> bool,
adamc@919 77 bind : 'context * binder -> 'context} -> 'context -> Mono.exp -> bool
adamc@919 78
adamc@567 79 val foldB : {typ : Mono.typ' * 'state -> 'state,
adamc@567 80 exp : 'context * Mono.exp' * 'state -> 'state,
adamc@567 81 bind : 'context * binder -> 'context}
adamc@567 82 -> 'context -> 'state -> Mono.exp -> 'state
adam@1612 83
adam@1612 84 val appLoc : (Mono.exp -> unit) -> Mono.exp -> unit
adamc@26 85 end
adamc@26 86
adamc@26 87 structure Decl : sig
adamc@26 88 datatype binder = datatype Exp.binder
adamc@26 89
adamc@26 90 val mapfoldB : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 91 exp : ('typtext, Mono.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 92 decl : ('typtext, Mono.decl', 'state, 'abort) Search.mapfolderB,
adamc@26 93 bind : 'typtext * binder -> 'typtext}
adamc@26 94 -> ('typtext, Mono.decl, 'state, 'abort) Search.mapfolderB
adamc@26 95 val mapfold : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 96 exp : (Mono.exp', 'state, 'abort) Search.mapfolder,
adamc@26 97 decl : (Mono.decl', 'state, 'abort) Search.mapfolder}
adamc@26 98 -> (Mono.decl, 'state, 'abort) Search.mapfolder
adamc@26 99
adamc@26 100 val fold : {typ : Mono.typ' * 'state -> 'state,
adamc@26 101 exp : Mono.exp' * 'state -> 'state,
adamc@26 102 decl : Mono.decl' * 'state -> 'state}
adamc@26 103 -> 'state -> Mono.decl -> 'state
adamc@506 104
adamc@506 105 val map : {typ : Mono.typ' -> Mono.typ',
adamc@506 106 exp : Mono.exp' -> Mono.exp',
adamc@506 107 decl : Mono.decl' -> Mono.decl'}
adamc@506 108 -> Mono.decl -> Mono.decl
adamc@567 109
adam@1800 110 val foldMap : {typ : Mono.typ' * 'state -> Mono.typ' * 'state,
adam@1800 111 exp : Mono.exp' * 'state -> Mono.exp' * 'state,
adam@1800 112 decl : Mono.decl' * 'state -> Mono.decl' * 'state}
adam@1800 113 -> 'state -> Mono.decl -> Mono.decl * 'state
adam@1800 114
adamc@567 115 val foldMapB : {typ : Mono.typ' * 'state -> Mono.typ' * 'state,
adamc@567 116 exp : 'context * Mono.exp' * 'state -> Mono.exp' * 'state,
adamc@567 117 decl : 'context * Mono.decl' * 'state -> Mono.decl' * 'state,
adamc@567 118 bind : 'context * binder -> 'context}
adamc@567 119 -> 'context -> 'state -> Mono.decl -> Mono.decl * 'state
adam@1847 120
adam@1847 121 val exists : {typ : Mono.typ' -> bool,
adam@1847 122 exp : Mono.exp' -> bool,
adam@1847 123 decl : Mono.decl' -> bool} -> Mono.decl -> bool
adamc@26 124 end
adamc@26 125
adamc@26 126 structure File : sig
adamc@26 127 datatype binder = datatype Exp.binder
adamc@26 128
adamc@26 129 val mapfoldB : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 130 exp : ('typtext, Mono.exp', 'state, 'abort) Search.mapfolderB,
adamc@26 131 decl : ('typtext, Mono.decl', 'state, 'abort) Search.mapfolderB,
adamc@26 132 bind : 'typtext * binder -> 'typtext}
adamc@26 133 -> ('typtext, Mono.file, 'state, 'abort) Search.mapfolderB
adamc@26 134
adamc@26 135 val mapfold : {typ : (Mono.typ', 'state, 'abort) Search.mapfolder,
adamc@26 136 exp : (Mono.exp', 'state, 'abort) Search.mapfolder,
adamc@26 137 decl : (Mono.decl', 'state, 'abort) Search.mapfolder}
adamc@26 138 -> (Mono.file, 'state, 'abort) Search.mapfolder
adamc@26 139
adamc@26 140 val mapB : {typ : Mono.typ' -> Mono.typ',
adamc@26 141 exp : 'typtext -> Mono.exp' -> Mono.exp',
adamc@26 142 decl : 'typtext -> Mono.decl' -> Mono.decl',
adamc@26 143 bind : 'typtext * binder -> 'typtext}
adamc@26 144 -> 'typtext -> Mono.file -> Mono.file
adamc@26 145
adamc@96 146 val map : {typ : Mono.typ' -> Mono.typ',
adamc@96 147 exp : Mono.exp' -> Mono.exp',
adamc@96 148 decl : Mono.decl' -> Mono.decl'}
adamc@96 149 -> Mono.file -> Mono.file
adamc@96 150
adamc@26 151 val fold : {typ : Mono.typ' * 'state -> 'state,
adamc@26 152 exp : Mono.exp' * 'state -> 'state,
adamc@26 153 decl : Mono.decl' * 'state -> 'state}
adamc@26 154 -> 'state -> Mono.file -> 'state
adamc@506 155
adamc@506 156 val maxName : Mono.file -> int
adam@1612 157
adam@1612 158 val appLoc : (Mono.exp -> unit) -> Mono.file -> unit
adamc@26 159 end
adamc@26 160
adamc@26 161 end