haskelldb-2.2.2: A library of combinators for generating and executing SQL statements.

Portability | non-portable
Stability | experimental
Maintainer | haskelldb-users@lists.sourceforge.net
Safe Haskell | None

Database.HaskellDB.BoundedList

Description

The main idea of bounded lists is to create lists with predetermined maximum size.

BoundedList is a simple, fast and type safe approach to implementing this idea. The implementation is based on inductive instances, making it very easy to expand with new bounds. A new bound only requires one instance of size and two instances of Less.

BoundedList works as follows. Every bound is build up by declaring a data-type representing the new bound. The instance of size only returns the size as an Int. The first instance of Less is for telling the typechecker that this bound is greater than the largest smaller bound. The second instance of Less is used by the typechecker to construct a chain of instances if there is no hardcoded instance available. This way the type checker can determine if a bound is smaller/greater then any other bound.

This inductive approach gives the complexity O(n) on the number of instances and very short type checking times compared to an O(n^2) implementation.

BoundedList also comes with a few utility function for manipulation an contructing bounded lists.

To be noted: Since each bound is a unique type: Explicit shrink and/or grow is needed before using (==). BoundedList does not have an instance of Ordering. (This might change)

Synopsis

- shrink :: (Size n, Size m) => BoundedList a n -> Maybe (BoundedList a m)
- grow :: LessEq n m => BoundedList a n -> BoundedList a m
- trunc :: Size n => [a] -> BoundedList a n
- listBound :: Size n => BoundedList a n -> Int
- toBounded :: Size n => [a] -> Maybe (BoundedList a n)
- fromBounded :: Size n => BoundedList a n -> [a]
- class Size n
- data BoundedList a n
- data N0
- data N1
- data N2
- data N3
- data N4
- data N5
- data N6
- data N7
- data N8
- data N9
- data N10
- data N11
- data N12
- data N13
- data N14
- data N15
- data N16
- data N17
- data N18
- data N19
- data N20
- data N21
- data N22
- data N23
- data N24
- data N25
- data N26
- data N27
- data N28
- data N29
- data N30
- data N31
- data N32
- data N33
- data N34
- data N35
- data N36
- data N37
- data N38
- data N39
- data N40
- data N41
- data N42
- data N43
- data N44
- data N45
- data N46
- data N47
- data N48
- data N49
- data N50
- data N51
- data N52
- data N53
- data N54
- data N55
- data N56
- data N57
- data N58
- data N59
- data N60
- data N61
- data N62
- data N63
- data N64
- data N65
- data N66
- data N67
- data N68
- data N69
- data N70
- data N71
- data N72
- data N73
- data N74
- data N75
- data N76
- data N77
- data N78
- data N79
- data N80
- data N81
- data N82
- data N83
- data N84
- data N85
- data N86
- data N87
- data N88
- data N89
- data N90
- data N91
- data N92
- data N93
- data N94
- data N95
- data N96
- data N97
- data N98
- data N99
- data N100
- data N101
- data N102
- data N103
- data N104
- data N105
- data N106
- data N107
- data N108
- data N109
- data N110
- data N111
- data N112
- data N113
- data N114
- data N115
- data N116
- data N117
- data N118
- data N119
- data N120
- data N121
- data N122
- data N123
- data N124
- data N125
- data N126
- data N127
- data N128
- data N129
- data N130
- data N131
- data N132
- data N133
- data N134
- data N135
- data N136
- data N137
- data N138
- data N139
- data N140
- data N141
- data N142
- data N143
- data N144
- data N145
- data N146
- data N147
- data N148
- data N149
- data N150
- data N151
- data N152
- data N153
- data N154
- data N155
- data N156
- data N157
- data N158
- data N159
- data N160
- data N161
- data N162
- data N163
- data N164
- data N165
- data N166
- data N167
- data N168
- data N169
- data N170
- data N171
- data N172
- data N173
- data N174
- data N175
- data N176
- data N177
- data N178
- data N179
- data N180
- data N181
- data N182
- data N183
- data N184
- data N185
- data N186
- data N187
- data N188
- data N189
- data N190
- data N191
- data N192
- data N193
- data N194
- data N195
- data N196
- data N197
- data N198
- data N199
- data N200
- data N201
- data N202
- data N203
- data N204
- data N205
- data N206
- data N207
- data N208
- data N209
- data N210
- data N211
- data N212
- data N213
- data N214
- data N215
- data N216
- data N217
- data N218
- data N219
- data N220
- data N221
- data N222
- data N223
- data N224
- data N225
- data N226
- data N227
- data N228
- data N229
- data N230
- data N231
- data N232
- data N233
- data N234
- data N235
- data N236
- data N237
- data N238
- data N239
- data N240
- data N241
- data N242
- data N243
- data N244
- data N245
- data N246
- data N247
- data N248
- data N249
- data N250
- data N251
- data N252
- data N253
- data N254
- data N255
- data N65535

# Documentation

shrink :: (Size n, Size m) => BoundedList a n -> Maybe (BoundedList a m)Source

Shrinks the `BoundedList` supplied if it can do so without truncating the list. Returns Nothing if the list inside was to long.

grow :: LessEq n m => BoundedList a n -> BoundedList a mSource

Takes a `BoundedList` add grows it size.

trunc :: Size n => [a] -> BoundedList a nSource

Takes a list and transforms it to a `BoundedList`. If the list doesn'n fit, the list is truncated to make it fit into the bounded list.

listBound :: Size n => BoundedList a n -> Int Source

Returns the length of a `BoundedList`.

toBounded :: Size n => [a] -> Maybe (BoundedList a n)Source

Takes a list and transforms it to a `BoundedList`. If the list doesn't fit, Nothing is returned.

fromBounded :: Size n => BoundedList a n -> [a]Source

Takes a `BoundedList` and return the list inside.

class Size n Source

Instances

Size N65535 |
Size N255 |
Size N254 |
Size N253 |
Size N252 |
Size N251 |
Size N250 |
Size N249 |
Size N248 |
Size N247 |
Size N246 |
Size N245 |
Size N244 |
Size N243 |
Size N242 |
Size N241 |
Size N240 |
Size N239 |
Size N238 |
Size N237 |
Size N236 |
Size N235 |
Size N234 |
Size N233 |
Size N232 |
Size N231 |
Size N230 |
Size N229 |
Size N228 |
Size N227 |
Size N226 |
Size N225 |
Size N224 |
Size N223 |
Size N222 |
Size N221 |
Size N220 |
Size N219 |
Size N218 |
Size N217 |
Size N216 |
Size N215 |
Size N214 |
Size N213 |
Size N212 |
Size N211 |
Size N210 |
Size N209 |
Size N208 |
Size N207 |
Size N206 |
Size N205 |
Size N204 |
Size N203 |
Size N202 |
Size N201 |
Size N200 |
Size N199 |
Size N198 |
Size N197 |
Size N196 |
Size N195 |
Size N194 |
Size N193 |
Size N192 |
Size N191 |
Size N190 |
Size N189 |
Size N188 |
Size N187 |
Size N186 |
Size N185 |
Size N184 |
Size N183 |
Size N182 |
Size N181 |
Size N180 |
Size N179 |
Size N178 |
Size N177 |
Size N176 |
Size N175 |
Size N174 |
Size N173 |
Size N172 |
Size N171 |
Size N170 |
Size N169 |
Size N168 |
Size N167 |
Size N166 |
Size N165 |
Size N164 |
Size N163 |
Size N162 |
Size N161 |
Size N160 |
Size N159 |
Size N158 |
Size N157 |
Size N156 |
Size N155 |
Size N154 |
Size N153 |
Size N152 |
Size N151 |
Size N150 |
Size N149 |
Size N148 |
Size N147 |
Size N146 |
Size N145 |
Size N144 |
Size N143 |
Size N142 |
Size N141 |
Size N140 |
Size N139 |
Size N138 |
Size N137 |
Size N136 |
Size N135 |
Size N134 |
Size N133 |
Size N132 |
Size N131 |
Size N130 |
Size N129 |
Size N128 |
Size N127 |
Size N126 |
Size N125 |
Size N124 |
Size N123 |
Size N122 |
Size N121 |
Size N120 |
Size N119 |
Size N118 |
Size N117 |
Size N116 |
Size N115 |
Size N114 |
Size N113 |
Size N112 |
Size N111 |
Size N110 |
Size N109 |
Size N108 |
Size N107 |
Size N106 |
Size N105 |
Size N104 |
Size N103 |
Size N102 |
Size N101 |
Size N100 |
Size N99 |
Size N98 |
Size N97 |
Size N96 |
Size N95 |
Size N94 |
Size N93 |
Size N92 |
Size N91 |
Size N90 |
Size N89 |
Size N88 |
Size N87 |
Size N86 |
Size N85 |
Size N84 |
Size N83 |
Size N82 |
Size N81 |
Size N80 |
Size N79 |
Size N78 |
Size N77 |
Size N76 |
Size N75 |
Size N74 |
Size N73 |
Size N72 |
Size N71 |
Size N70 |
Size N69 |
Size N68 |
Size N67 |
Size N66 |
Size N65 |
Size N64 |
Size N63 |
Size N62 |
Size N61 |
Size N60 |
Size N59 |
Size N58 |
Size N57 |
Size N56 |
Size N55 |
Size N54 |
Size N53 |
Size N52 |
Size N51 |
Size N50 |
Size N49 |
Size N48 |
Size N47 |
Size N46 |
Size N45 |
Size N44 |
Size N43 |
Size N42 |
Size N41 |
Size N40 |
Size N39 |
Size N38 |
Size N37 |
Size N36 |
Size N35 |
Size N34 |
Size N33 |
Size N32 |
Size N31 |
Size N30 |
Size N29 |
Size N28 |
Size N27 |
Size N26 |
Size N25 |
Size N24 |
Size N23 |
Size N22 |
Size N21 |
Size N20 |
Size N19 |
Size N18 |
Size N17 |
Size N16 |
Size N15 |
Size N14 |
Size N13 |
Size N12 |
Size N11 |
Size N10 |
Size N9 |
Size N8 |
Size N7 |
Size N6 |
Size N5 |
Size N4 |
Size N3 |
Size N2 |
Size N1 |
Size N0 |

data BoundedList a n Source

Instances

Typeable (BoundedString n) |
Size n => ShowConstant (BoundedString n) |
Size n => ExprType (BoundedString n) |
Size n => GetValue (Maybe (BoundedString n)) |
Size n => GetValue (BoundedString n) |
(Size n, Eq a) => Eq (BoundedList a n) |
(Show a, Size n) => Show (BoundedList a n) |

data N0 Source

Instances

Size N0 |

data N1 Source

Instances

Size N1 |

data N2 Source

Instances

Size N2 |

data N3 Source

Instances

Size N3 |

data N4 Source

Instances

Size N4 |

data N5 Source

Instances

Size N5 |

data N6 Source

Instances

Size N6 |

data N7 Source

Instances

Size N7 |

data N8 Source

Instances

Size N8 |

data N9 Source

Instances

Size N9 |

data N10 Source

Instances

Size N10 |

data N11 Source

Instances

Size N11 |

data N12 Source

Instances

Size N12 |

data N13 Source

Instances

Size N13 |

data N14 Source

Instances

Size N14 |

data N15 Source

Instances

Size N15 |

data N16 Source

Instances

Size N16 |

data N17 Source

Instances

Size N17 |

data N18 Source

Instances

Size N18 |

data N19 Source

Instances

Size N19 |

data N20 Source

Instances

Size N20 |

data N21 Source

Instances

Size N21 |

data N22 Source

Instances

Size N22 |

data N23 Source

Instances

Size N23 |

data N24 Source

Instances

Size N24 |

data N25 Source

Instances

Size N25 |

data N26 Source

Instances

Size N26 |

data N27 Source

Instances

Size N27 |

data N28 Source

Instances

Size N28 |

data N29 Source

Instances

Size N29 |

data N30 Source

Instances

Size N30 |

data N31 Source

Instances

Size N31 |

data N32 Source

Instances

Size N32 |

data N33 Source

Instances

Size N33 |

data N34 Source

Instances

Size N34 |

data N35 Source

Instances

Size N35 |

data N36 Source

Instances

Size N36 |

data N37 Source

Instances

Size N37 |

data N38 Source

Instances

Size N38 |

data N39 Source

Instances

Size N39 |

data N40 Source

Instances

Size N40 |

data N41 Source

Instances

Size N41 |

data N42 Source

Instances

Size N42 |

data N43 Source

Instances

Size N43 |

data N44 Source

Instances

Size N44 |

data N45 Source

Instances

Size N45 |

data N46 Source

Instances

Size N46 |

data N47 Source

Instances

Size N47 |

data N48 Source

Instances

Size N48 |

data N49 Source

Instances

Size N49 |

data N50 Source

Instances

Size N50 |

data N51 Source

Instances

Size N51 |

data N52 Source

Instances

Size N52 |

data N53 Source

Instances

Size N53 |

data N54 Source

Instances

Size N54 |

data N55 Source

Instances

Size N55 |

data N56 Source

Instances

Size N56 |

data N57 Source

Instances

Size N57 |

data N58 Source

Instances

Size N58 |

data N59 Source

Instances

Size N59 |

data N60 Source

Instances

Size N60 |

data N61 Source

Instances

Size N61 |

data N62 Source

Instances

Size N62 |

data N63 Source

Instances

Size N63 |

data N64 Source

Instances

Size N64 |

data N65 Source

Instances

Size N65 |

data N66 Source

Instances

Size N66 |

data N67 Source

Instances

Size N67 |

data N68 Source

Instances

Size N68 |

data N69 Source

Instances

Size N69 |

data N70 Source

Instances

Size N70 |

data N71 Source

Instances

Size N71 |

data N72 Source

Instances

Size N72 |

data N73 Source

Instances

Size N73 |

data N74 Source

Instances

Size N74 |

data N75 Source

Instances

Size N75 |

data N76 Source

Instances

Size N76 |

data N77 Source

Instances

Size N77 |

data N78 Source

Instances

Size N78 |

data N79 Source

Instances

Size N79 |

data N80 Source

Instances

Size N80 |

data N81 Source

Instances

Size N81 |

data N82 Source

Instances

Size N82 |

data N83 Source

Instances

Size N83 |

data N84 Source

Instances

Size N84 |

data N85 Source

Instances

Size N85 |

data N86 Source

Instances

Size N86 |

data N87 Source

Instances

Size N87 |

data N88 Source

Instances

Size N88 |

data N89 Source

Instances

Size N89 |

data N90 Source

Instances

Size N90 |

data N91 Source

Instances

Size N91 |

data N92 Source

Instances

Size N92 |

data N93 Source

Instances

Size N93 |

data N94 Source

Instances

Size N94 |

data N95 Source

Instances

Size N95 |

data N96 Source

Instances

Size N96 |

data N97 Source

Instances

Size N97 |

data N98 Source

Instances

Size N98 |

data N99 Source

Instances

Size N99 |

data N100 Source

Instances

Size N100 |

data N101 Source

Instances

Size N101 |

data N102 Source

Instances

Size N102 |

data N103 Source

Instances

Size N103 |

data N104 Source

Instances

Size N104 |

data N105 Source

Instances

Size N105 |

data N106 Source

Instances

Size N106 |

data N107 Source

Instances

Size N107 |

data N108 Source

Instances

Size N108 |

data N109 Source

Instances

Size N109 |

data N110 Source

Instances

Size N110 |

data N111 Source

Instances

Size N111 |

data N112 Source

Instances

Size N112 |

data N113 Source

Instances

Size N113 |

data N114 Source

Instances

Size N114 |

data N115 Source

Instances

Size N115 |

data N116 Source

Instances

Size N116 |

data N117 Source

Instances

Size N117 |

data N118 Source

Instances

Size N118 |

data N119 Source

Instances

Size N119 |

data N120 Source

Instances

Size N120 |

data N121 Source

Instances

Size N121 |

data N122 Source

Instances

Size N122 |

data N123 Source

Instances

Size N123 |

data N124 Source

Instances

Size N124 |

data N125 Source

Instances

Size N125 |

data N126 Source

Instances

Size N126 |

data N127 Source

Instances

Size N127 |

data N128 Source

Instances

Size N128 |

data N129 Source

Instances

Size N129 |

data N130 Source

Instances

Size N130 |

data N131 Source

Instances

Size N131 |

data N132 Source

Instances

Size N132 |

data N133 Source

Instances

Size N133 |

data N134 Source

Instances

Size N134 |

data N135 Source

Instances

Size N135 |

data N136 Source

Instances

Size N136 |

data N137 Source

Instances

Size N137 |

data N138 Source

Instances

Size N138 |

data N139 Source

Instances

Size N139 |

data N140 Source

Instances

Size N140 |

data N141 Source

Instances

Size N141 |

data N142 Source

Instances

Size N142 |

data N143 Source

Instances

Size N143 |

data N144 Source

Instances

Size N144 |

data N145 Source

Instances

Size N145 |

data N146 Source

Instances

Size N146 |

data N147 Source

Instances

Size N147 |

data N148 Source

Instances

Size N148 |

data N149 Source

Instances

Size N149 |

data N150 Source

Instances

Size N150 |

data N151 Source

Instances

Size N151 |

data N152 Source

Instances

Size N152 |

data N153 Source

Instances

Size N153 |

data N154 Source

Instances

Size N154 |

data N155 Source

Instances

Size N155 |

data N156 Source

Instances

Size N156 |

data N157 Source

Instances

Size N157 |

data N158 Source

Instances

Size N158 |

data N159 Source

Instances

Size N159 |

data N160 Source

Instances

Size N160 |

data N161 Source

Instances

Size N161 |

data N162 Source

Instances

Size N162 |

data N163 Source

Instances

Size N163 |

data N164 Source

Instances

Size N164 |

data N165 Source

Instances

Size N165 |

data N166 Source

Instances

Size N166 |

data N167 Source

Instances

Size N167 |

data N168 Source

Instances

Size N168 |

data N169 Source

Instances

Size N169 |

data N170 Source

Instances

Size N170 |

data N171 Source

Instances

Size N171 |

data N172 Source

Instances

Size N172 |

data N173 Source

Instances

Size N173 |

data N174 Source

Instances

Size N174 |

data N175 Source

Instances

Size N175 |

data N176 Source

Instances

Size N176 |

data N177 Source

Instances

Size N177 |

data N178 Source

Instances

Size N178 |

data N179 Source

Instances

Size N179 |

data N180 Source

Instances

Size N180 |

data N181 Source

Instances

Size N181 |

data N182 Source

Instances

Size N182 |

data N183 Source

Instances

Size N183 |

data N184 Source

Instances

Size N184 |

data N185 Source

Instances

Size N185 |

data N186 Source

Instances

Size N186 |

data N187 Source

Instances

Size N187 |

data N188 Source

Instances

Size N188 |

data N189 Source

Instances

Size N189 |

data N190 Source

Instances

Size N190 |

data N191 Source

Instances

Size N191 |

data N192 Source

Instances

Size N192 |

data N193 Source

Instances

Size N193 |

data N194 Source

Instances

Size N194 |

data N195 Source

Instances

Size N195 |

data N196 Source

Instances

Size N196 |

data N197 Source

Instances

Size N197 |

data N198 Source

Instances

Size N198 |

data N199 Source

Instances

Size N199 |

data N200 Source

Instances

Size N200 |

data N201 Source

Instances

Size N201 |

data N202 Source

Instances

Size N202 |

data N203 Source

Instances

Size N203 |

data N204 Source

Instances

Size N204 |

data N205 Source

Instances

Size N205 |

data N206 Source

Instances

Size N206 |

data N207 Source

Instances

Size N207 |

data N208 Source

Instances

Size N208 |

data N209 Source

Instances

Size N209 |

data N210 Source

Instances

Size N210 |

data N211 Source

Instances

Size N211 |

data N212 Source

Instances

Size N212 |

data N213 Source

Instances

Size N213 |

data N214 Source

Instances

Size N214 |

data N215 Source

Instances

Size N215 |

data N216 Source

Instances

Size N216 |

data N217 Source

Instances

Size N217 |

data N218 Source

Instances

Size N218 |

data N219 Source

Instances

Size N219 |

data N220 Source

Instances

Size N220 |

data N221 Source

Instances

Size N221 |

data N222 Source

Instances

Size N222 |

data N223 Source

Instances

Size N223 |

data N224 Source

Instances

Size N224 |

data N225 Source

Instances

Size N225 |

data N226 Source

Instances

Size N226 |

data N227 Source

Instances

Size N227 |

data N228 Source

Instances

Size N228 |

data N229 Source

Instances

Size N229 |

data N230 Source

Instances

Size N230 |

data N231 Source

Instances

Size N231 |

data N232 Source

Instances

Size N232 |

data N233 Source

Instances

Size N233 |

data N234 Source

Instances

Size N234 |

data N235 Source

Instances

Size N235 |

data N236 Source

Instances

Size N236 |

data N237 Source

Instances

Size N237 |

data N238 Source

Instances

Size N238 |

data N239 Source

Instances

Size N239 |

data N240 Source

Instances

Size N240 |

data N241 Source

Instances

Size N241 |

data N242 Source

Instances

Size N242 |

data N243 Source

Instances

Size N243 |

data N244 Source

Instances

Size N244 |

data N245 Source

Instances

Size N245 |

data N246 Source

Instances

Size N246 |

data N247 Source

Instances

Size N247 |

data N248 Source

Instances

Size N248 |

data N249 Source

Instances

Size N249 |

data N250 Source

Instances

Size N250 |

data N251 Source

Instances

Size N251 |

data N252 Source

Instances

Size N252 |

data N253 Source

Instances

Size N253 |

data N254 Source

Instances

Size N254 |

data N255 Source

Instances

Size N255 |

data N65535 Source

Instances

Size N65535 |