Prelude/BasicClasses.ad

Outline

Content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
module Prelude.BasicClasses (
  Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum(..)class-constant `enumFromTo`
class-constant `fromEnum`
class-constant `pred`
class-constant `succ`
class-constant `toEnum`
,
  Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum(..)class-constant `maxBound`
class-constant `minBound`
,
  Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum(..)class-constant `existsB_fun`
class-constant `forallB_fun`
class-constant `uexistsB_fun`
class-constant `universeFoldWithAbort`
class-constant `universeList`
,

  Monoidtype-class `Prelude.BasicClasses.Monoid`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.BasicClasses.Semigroup 'a(..)class-constant `mempty`
,
  mappendconstant `Prelude.BasicClasses.mappend`
   constant
   type `Monoid 'a => 'a -> 'a -> 'a`
   executable,
  Semigrouptype-class `Prelude.BasicClasses.Semigroup`
   arguments: ('a :: *)(..)class-constant `(<>)`

) where

{-# NoImplicitPrelude #-}

import Prelude.Bool
import Prelude.Function
import Prelude.Num
import Prelude.Eq
import Prelude.Ord
import Prelude.Maybe
import Prelude.Either
import Prelude.Template
import Prelude.Unit ()
import Prelude.List hiding (mapconstant `Prelude.List.map`
   constant
   type `('a -> 'b) -> ['a] -> ['b]`
   executable)


class Ordtype-class `Prelude.Ord.Ord`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Eq.Eq 'a
   has default derive templates 'atype-variable `'a`
   kind `*` => Enum 'atype-variable `'a`
   kind `*` where
  declare succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable :: 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*`
  declare predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable :: 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*`

  declare fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable :: 'atype-variable `'a`
   kind `*` -> Naturaldatatype `Prelude.Num.Natural`
   kind `*`
   executable
  declare toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable :: Naturaldatatype `Prelude.Num.Natural`
   kind `*`
   executable -> Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`

  define succconstant `Prelude.BasicClasses.succ`
   default instance of type-class constant
   type `('a -> Natural) -> (Natural -> Maybe 'a) -> 'a -> 'a`
   executable avariable `a`
   type `'a` := fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable avariable `a`
   type `'a` (toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance avariable `a`
   type `'a` +constant `Prelude.Num.(+)`
   constant of type-class `NumPlus`
   type `'a -> 'a -> 'a`
   type in context `Natural -> Natural -> Natural`
   executable
   statically resolved type-class instance 1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1))
  define predconstant `Prelude.BasicClasses.pred`
   default instance of type-class constant
   type `('a -> Natural) -> (Natural -> Maybe 'a) -> 'a -> 'a`
   executable avariable `a`
   type `'a` := fromMaybeconstant `Prelude.Maybe.fromMaybe`
   constant
   type `'a -> Maybe 'a -> 'a`
   executable avariable `a`
   type `'a` (toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance avariable `a`
   type `'a` -constant `Prelude.Num.(-)`
   constant of type-class `NumMinus`
   type `'a -> 'a -> 'a`
   type in context `Natural -> Natural -> Natural`
   executable
   statically resolved type-class instance 1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1))

  declare enumFromToconstant `Prelude.BasicClasses.enumFromTo`
   constant of type-class `Enum`
   type `'a -> 'a -> ['a]`
   executable :: 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*` -> ['atype-variable `'a`
   kind `*`]
  define rec enumFromToconstant `Prelude.BasicClasses.enumFromTo`
   default instance of type-class constant
   type `('a -> 'a) -> 'a -> 'a -> ['a]`
   executable nvariable `n`
   type `'a` mvariable `m`
   type `'a` :=
    if (nvariable `n`
   type `'a` >constant `Prelude.Ord.(>)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context mvariable `m`
   type `'a`) then [] else nvariable `n`
   type `'a` :constant `Prelude.List.(:)`
   constructor of datatype `List`
   type `'a -> ['a] -> ['a]`
   executable (enumFromToconstant `Prelude.BasicClasses.enumFromTo`
   constant of type-class `Enum`
   type `'a -> 'a -> ['a]`
   executable
   same type-class instance (succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance nvariable `n`
   type `'a`) mvariable `m`
   type `'a`)

  test toFromEnumInvconstant `Prelude.BasicClasses.toFromEnumInv`
   type-class test
   type `'a -> Bool`
   executable (avariable `a`
   type `'a` :: 'atype-variable `'a`
   kind `*`) :=
    toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance avariable `a`
   type `'a`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   type in context `Maybe 'a -> Maybe 'a -> Bool`
   executable
   statically resolved type-class instance Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   executable avariable `a`
   type `'a`

  test fromEnum11constant `Prelude.BasicClasses.fromEnum11`
   type-class test
   type `'a -> 'a -> Bool`
   executable a1variable `a1`
   type `'a` a2variable `a2`
   type `'a` :=
         (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance a1variable `a1`
   type `'a` ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance a2variable `a2`
   type `'a`) <->constant `Prelude.Bool.(<->)`
   constant
   type `Bool -> Bool -> Bool`
   executable (a1variable `a1`
   type `'a` ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context a2variable `a2`
   type `'a`)

  test toEnumBounds0constant `Prelude.BasicClasses.toEnumBounds0`
   type-class test
   type `Bool`
   executable := isJustconstant `Prelude.Maybe.isJust`
   constant
   type `Maybe 'a -> Bool`
   executable ((toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance 0natural number literal
   type `Natural`
   decimal value: 0
   hexadecimal value: 0x0
   octal value: 0o0
   binary value: 0b0) :: Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`)
  test toEnumBoundsSmallerconstant `Prelude.BasicClasses.toEnumBoundsSmaller`
   type-class test
   type `Natural -> Natural -> Bool`
   executable ivariable `i`
   type `Natural` jvariable `j`
   type `Natural` :=
    (ivariable `i`
   type `Natural` >constant `Prelude.Ord.(>)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance jvariable `j`
   type `Natural`) -->constant `Prelude.Bool.(-->)`
   constant
   type `Bool -> Bool -> Bool`
   executable
    isJustconstant `Prelude.Maybe.isJust`
   constant
   type `Maybe 'a -> Bool`
   executable ((toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance ivariable `i`
   type `Natural`) :: Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`) -->constant `Prelude.Bool.(-->)`
   constant
   type `Bool -> Bool -> Bool`
   executable
    isJustconstant `Prelude.Maybe.isJust`
   constant
   type `Maybe 'a -> Bool`
   executable ((toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   same type-class instance jvariable `j`
   type `Natural`) :: Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`)

  test compareOKconstant `Prelude.BasicClasses.compareOK`
   type-class test
   type `'a -> 'a -> Bool`
   executable a1variable `a1`
   type `'a` a2variable `a2`
   type `'a` :=
    compareconstant `Prelude.Ord.compare`
   constant of type-class `Ord`
   type `'a -> 'a -> Ordering`
   executable
   type-class instance from context a1variable `a1`
   type `'a` a2variable `a2`
   type `'a` ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   type in context `Ordering -> Ordering -> Bool`
   executable
   statically resolved type-class instance compareconstant `Prelude.Ord.compare`
   constant of type-class `Ord`
   type `'a -> 'a -> Ordering`
   type in context `Natural -> Natural -> Ordering`
   executable
   statically resolved type-class instance (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance a1variable `a1`
   type `'a`) (fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   same type-class instance a2variable `a2`
   type `'a`)

  test succ_greater_okconstant `Prelude.BasicClasses.succ_greater_ok`
   type-class test
   type `'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a` >=constant `Prelude.Ord.(>=)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context xvariable `x`
   type `'a`)
  test pred_smaller_okconstant `Prelude.BasicClasses.pred_smaller_ok`
   type-class test
   type `'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a` <=constant `Prelude.Ord.(<=)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context xvariable `x`
   type `'a`)

  test Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => succ_bound_okconstant `Prelude.BasicClasses.succ_bound_ok`
   type-class test
   type `Bounded 'a => 'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) :=
          (xvariable `x`
   type `'a` <constant `Prelude.Ord.(<)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument) -->constant `Prelude.Bool.(-->)`
   constant
   type `Bool -> Bool -> Bool`
   executable ((succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a` >constant `Prelude.Ord.(>)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument xvariable `x`
   type `'a`) &&constant `Prelude.Bool.(&&)`
   constant
   type `Bool -> Bool -> Bool`
   executable (predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance (succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument xvariable `x`
   type `'a`))
  test Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => pred_bound_okconstant `Prelude.BasicClasses.pred_bound_ok`
   type-class test
   type `Bounded 'a => 'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) :=
          (xvariable `x`
   type `'a` >constant `Prelude.Ord.(>)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument) -->constant `Prelude.Bool.(-->)`
   constant
   type `Bool -> Bool -> Bool`
   executable ((predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a` <constant `Prelude.Ord.(<)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument xvariable `x`
   type `'a`) &&constant `Prelude.Bool.(&&)`
   constant
   type `Bool -> Bool -> Bool`
   executable (succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance (predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance xvariable `x`
   type `'a`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument xvariable `x`
   type `'a`))
  test Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => pred_minboundconstant `Prelude.BasicClasses.pred_minbound`
   type-class test
   type `Bounded 'a => Bool`
   executable := predconstant `Prelude.BasicClasses.pred`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance (minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument :: 'atype-variable `'a`
   kind `*`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument
  test Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => succ_maxboundconstant `Prelude.BasicClasses.succ_maxbound`
   type-class test
   type `Bounded 'a => Bool`
   executable := succconstant `Prelude.BasicClasses.succ`
   constant of type-class `Enum`
   type `'a -> 'a`
   executable
   same type-class instance (maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument :: 'atype-variable `'a`
   kind `*`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from argument maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   type-class instance from argument

  {-# minimal fromEnum, toEnum #-}
end-class

instance Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum Naturaldatatype `Prelude.Num.Natural`
   kind `*`
   executable where
  define succconstant `Prelude.BasicClasses.succ`
   constant of type-class instance `Enum Natural`
   type `Natural -> Natural`
   executable := (+)constant `Prelude.Num.(+)`
   constant of type-class `NumPlus`
   type `'a -> 'a -> 'a`
   type in context `Natural -> Natural -> Natural`
   executable
   statically resolved type-class instance 1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1
  define predconstant `Prelude.BasicClasses.pred`
   constant of type-class instance `Enum Natural`
   type `Natural -> Natural`
   executable := (-)constant `Prelude.Num.(-)`
   constant of type-class `NumMinus`
   type `'a -> 'a -> 'a`
   type in context `Natural -> Natural -> Natural`
   executable
   statically resolved type-class instance 1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1
  define toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class instance `Enum Natural`
   type `Natural -> Maybe Natural`
   executable nvariable `n`
   type `Natural` := Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   type in context `Natural -> Maybe Natural`
   executable nvariable `n`
   type `Natural`
  define fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class instance `Enum Natural`
   type `Natural -> Natural`
   executable nvariable `n`
   type `Natural` := nvariable `n`
   type `Natural`
end-instance

{-# allow-similar-names "minBound", "maxBound",  "minBound_ok", "maxBound_ok", "minBoundEnum", "maxBoundEnum" #-}

class Ordtype-class `Prelude.Ord.Ord`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Eq.Eq 'a
   has default derive templates 'atype-variable `'a`
   kind `*` => Bounded 'atype-variable `'a`
   kind `*` where
  declare minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable :: 'atype-variable `'a`
   kind `*`
  declare maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable :: 'atype-variable `'a`
   kind `*`

  test minBound_okconstant `Prelude.BasicClasses.minBound_ok`
   type-class test
   type `'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   same type-class instance :: 'atype-variable `'a`
   kind `*`) <=constant `Prelude.Ord.(<=)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context xvariable `x`
   type `'a`
  test maxBound_okconstant `Prelude.BasicClasses.maxBound_ok`
   type-class test
   type `'a -> Bool`
   executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   same type-class instance :: 'atype-variable `'a`
   kind `*`) >=constant `Prelude.Ord.(>=)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   executable
   type-class instance from context xvariable `x`
   type `'a`

  test Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => minBoundEnumconstant `Prelude.BasicClasses.minBoundEnum`
   type-class test
   type `Enum 'a => Bool`
   executable := fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   type-class instance from argument (minBoundconstant `Prelude.BasicClasses.minBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   same type-class instance :: 'atype-variable `'a`
   kind `*`) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance 0natural number literal
   type `Natural`
   decimal value: 0
   hexadecimal value: 0x0
   octal value: 0o0
   binary value: 0b0

  test Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => maxBoundEnumconstant `Prelude.BasicClasses.maxBoundEnum`
   type-class test
   type `Enum 'a => Natural -> Bool`
   executable ivariable `i`
   type `Natural` := (ivariable `i`
   type `Natural` >constant `Prelude.Ord.(>)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance fromEnumconstant `Prelude.BasicClasses.fromEnum`
   constant of type-class `Enum`
   type `'a -> Natural`
   executable
   type-class instance from argument (maxBoundconstant `Prelude.BasicClasses.maxBound`
   constant of type-class `Bounded`
   type `'a`
   executable
   same type-class instance :: 'atype-variable `'a`
   kind `*`)) -->constant `Prelude.Bool.(-->)`
   constant
   type `Bool -> Bool -> Bool`
   executable isNothingconstant `Prelude.Maybe.isNothing`
   constant
   type `Maybe 'a -> Bool`
   executable ((toEnumconstant `Prelude.BasicClasses.toEnum`
   constant of type-class `Enum`
   type `Natural -> Maybe 'a`
   executable
   type-class instance from argument ivariable `i`
   type `Natural`) :: Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`)
end-class


-- finite, type
class Finite 'atype-variable `'a`
   kind `*` where
  declare universeListconstant `Prelude.BasicClasses.universeList`
   constant of type-class `Finite`
   type `['a]`
   executable :: ['atype-variable `'a`
   kind `*`]

  declare universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable :: ('acctype-variable `'acc`
   kind `*` -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable) -> ('acctype-variable `'acc`
   kind `*` -> 'atype-variable `'a`
   kind `*` -> 'acctype-variable `'acc`
   kind `*`) -> 'acctype-variable `'acc`
   kind `*` -> 'acctype-variable `'acc`
   kind `*`
  {-# static resolve universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable #-}

  declare forallB_funconstant `Prelude.BasicClasses.forallB_fun`
   constant of type-class `Finite`
   type `('a -> Bool) -> Bool`
   executable :: ('atype-variable `'a`
   kind `*` -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable) -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable
  declare existsB_funconstant `Prelude.BasicClasses.existsB_fun`
   constant of type-class `Finite`
   type `('a -> Bool) -> Bool`
   executable :: ('atype-variable `'a`
   kind `*` -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable) -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable
  declare uexistsB_funconstant `Prelude.BasicClasses.uexistsB_fun`
   constant of type-class `Finite`
   type `('a -> Bool) -> Bool`
   executable :: ('atype-variable `'a`
   kind `*` -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable) -> Booldatatype `Prelude.Bool.Bool`
   kind `*`
   executable

  define universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   default instance of type-class constant
   type `['a] -> ('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> 'a -> 'acc` accvariable `acc`
   type `'acc` := foldlWithAbortconstant `Prelude.List.foldlWithAbort`
   constant
   type `('a -> Bool) -> ('a -> 'b -> 'a) -> 'a -> ['b] -> 'a`
   type in context `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> ['a] -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> 'a -> 'acc` accvariable `acc`
   type `'acc` universeListconstant `Prelude.BasicClasses.universeList`
   constant of type-class `Finite`
   type `['a]`
   executable
   same type-class instance
  define universeListconstant `Prelude.BasicClasses.universeList`
   default instance of type-class constant
   type `((['a] -> Bool) -> (['a] -> 'a -> ['a]) -> ['a] -> ['a]) -> ['a]`
   executable := universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `(['a] -> Bool) -> (['a] -> 'a -> ['a]) -> ['a] -> ['a]`
   executable
   same type-class instance (constantconstant `Prelude.Function.constant`
   constant
   type `'a -> 'b -> 'a`
   type in context `Bool -> ['a] -> Bool`
   executable Falseconstant `Prelude.Bool.False`
   constructor of datatype `Bool`
   type `Bool`
   executable) (fntype `['a] -> 'a -> ['a]` lvariable `l`
   type `['a]` evariable `e`
   type `'a` -> evariable `e`
   type `'a`:constant `Prelude.List.(:)`
   constructor of datatype `List`
   type `'a -> ['a] -> ['a]`
   executablelvariable `l`
   type `['a]`) []

  define forallB_funconstant `Prelude.BasicClasses.forallB_fun`
   default instance of type-class constant
   type `((Bool -> Bool) -> (Bool -> 'a -> Bool) -> Bool -> Bool) -> ('a -> Bool) -> Bool`
   executable pvariable `p`
   type `'a -> Bool` := universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `(Bool -> Bool) -> (Bool -> 'a -> Bool) -> Bool -> Bool`
   executable
   same type-class instance notconstant `Prelude.Bool.not`
   constant
   type `Bool -> Bool`
   executable (constantconstant `Prelude.Function.constant`
   constant
   type `'a -> 'b -> 'a`
   type in context `('a -> Bool) -> Bool -> 'a -> Bool`
   executable pvariable `p`
   type `'a -> Bool`) Trueconstant `Prelude.Bool.True`
   constructor of datatype `Bool`
   type `Bool`
   executable
  define existsB_funconstant `Prelude.BasicClasses.existsB_fun`
   default instance of type-class constant
   type `((Bool -> Bool) -> (Bool -> 'a -> Bool) -> Bool -> Bool) -> ('a -> Bool) -> Bool`
   executable pvariable `p`
   type `'a -> Bool` := universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `(Bool -> Bool) -> (Bool -> 'a -> Bool) -> Bool -> Bool`
   executable
   same type-class instance idconstant `Prelude.Function.id`
   constant
   type `'a -> 'a`
   type in context `Bool -> Bool`
   executable (constantconstant `Prelude.Function.constant`
   constant
   type `'a -> 'b -> 'a`
   type in context `('a -> Bool) -> Bool -> 'a -> Bool`
   executable pvariable `p`
   type `'a -> Bool`) Falseconstant `Prelude.Bool.False`
   constructor of datatype `Bool`
   type `Bool`
   executable
  define uexistsB_funconstant `Prelude.BasicClasses.uexistsB_fun`
   default instance of type-class constant
   type `((Natural -> Bool) -> (Natural -> 'a -> Natural) -> Natural -> Natural) -> ('a -> Bool) -> Bool`
   executable pvariable `p`
   type `'a -> Bool` :=
    (universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `(Natural -> Bool) -> (Natural -> 'a -> Natural) -> Natural -> Natural`
   executable
   same type-class instance (fntype `Natural -> Bool` cvariable `c`
   type `Natural` -> (cvariable `c`
   type `Natural` >=constant `Prelude.Ord.(>=)`
   constant of type-class `Ord`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance 2natural number literal
   type `Natural`
   decimal value: 2
   hexadecimal value: 0x2
   octal value: 0o2
   binary value: 0b10)) (fntype `Natural -> 'a -> Natural` cvariable `c`
   type `Natural` evariable `e`
   type `'a` -> if pvariable `p`
   type `'a -> Bool` evariable `e`
   type `'a` then cvariable `c`
   type `Natural` +constant `Prelude.Num.(+)`
   constant of type-class `NumPlus`
   type `'a -> 'a -> 'a`
   type in context `Natural -> Natural -> Natural`
   executable
   statically resolved type-class instance 1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1 else cvariable `c`
   type `Natural`) 0natural number literal
   type `Natural`
   decimal value: 0
   hexadecimal value: 0x0
   octal value: 0o0
   binary value: 0b0) ==constant `Prelude.Eq.(==)`
   constant of type-class `Eq`
   type `'a -> 'a -> Bool`
   type in context `Natural -> Natural -> Bool`
   executable
   statically resolved type-class instance (1natural number literal
   type `Natural`
   decimal value: 1
   hexadecimal value: 0x1
   octal value: 0o1
   binary value: 0b1 :: Natural)

  {-# minimal universeList | universeFoldWithAbort #-}
end-class


class Semigroup 'atype-variable `'a`
   kind `*` where
  declare (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class `Semigroup`
   type `'a -> 'a -> 'a`
   executable :: 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*`
end-class


class Semigrouptype-class `Prelude.BasicClasses.Semigroup`
   arguments: ('a :: *) 'atype-variable `'a`
   kind `*` => Monoid 'atype-variable `'a`
   kind `*` where
  declare memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class `Monoid`
   type `'a`
   executable :: 'atype-variable `'a`
   kind `*`

  property EqPtype-class `Prelude.Eq.EqP`
   arguments: ('a :: *)
   has default derive templates
   derive-template labels
     - eq (only deriving)
     - full 'atype-variable `'a`
   kind `*` => mempty_neutral_1constant `Prelude.BasicClasses.mempty_neutral_1`
   type-class property
   type `EqP 'a => 'a -> Prop`
   non-executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class `Monoid`
   type `'a`
   executable
   same type-class instance <>constant `Prelude.BasicClasses.(<>)`
   constant of type-class `Semigroup`
   type `'a -> 'a -> 'a`
   executable
   type-class instance from context xvariable `x`
   type `'a`) ===constant `Prelude.Eq.(===)`
   constant of type-class `EqP`
   type `'a -> 'a -> Prop`
   non-executable
   type-class instance from argument xvariable `x`
   type `'a`
  property EqPtype-class `Prelude.Eq.EqP`
   arguments: ('a :: *)
   has default derive templates
   derive-template labels
     - eq (only deriving)
     - full 'atype-variable `'a`
   kind `*` => mempty_neutral_2constant `Prelude.BasicClasses.mempty_neutral_2`
   type-class property
   type `EqP 'a => 'a -> Prop`
   non-executable (xvariable `x`
   type `'a` :: 'atype-variable `'a`
   kind `*`) := (xvariable `x`
   type `'a` <>constant `Prelude.BasicClasses.(<>)`
   constant of type-class `Semigroup`
   type `'a -> 'a -> 'a`
   executable
   type-class instance from context memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class `Monoid`
   type `'a`
   executable
   same type-class instance) ===constant `Prelude.Eq.(===)`
   constant of type-class `EqP`
   type `'a -> 'a -> Prop`
   non-executable
   type-class instance from argument xvariable `x`
   type `'a`
end-class

declare mappendconstant `Prelude.BasicClasses.mappend`
   constant
   type `Monoid 'a => 'a -> 'a -> 'a`
   executable :: Monoidtype-class `Prelude.BasicClasses.Monoid`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.BasicClasses.Semigroup 'a 'atype-variable `'a`
   kind `*` => 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*` -> 'atype-variable `'a`
   kind `*`
define mappendconstant `Prelude.BasicClasses.mappend`
   constant
   type `Monoid 'a => 'a -> 'a -> 'a`
   executable := (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class `Semigroup`
   type `'a -> 'a -> 'a`
   executable
   type-class instance from argument
{-# inline mappendconstant `Prelude.BasicClasses.mappend`
   constant
   type `Monoid 'a => 'a -> 'a -> 'a`
   executable #-}


instance Semigrouptype-class `Prelude.BasicClasses.Semigroup`
   arguments: ('a :: *) () where
  define (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup ()`
   type `() -> () -> ()`
   executable := constantconstant `Prelude.Function.constant`
   constant
   type `'a -> 'b -> 'a`
   type in context `(() -> ()) -> () -> () -> ()`
   executable (constantconstant `Prelude.Function.constant`
   constant
   type `'a -> 'b -> 'a`
   type in context `() -> () -> ()`
   executable ())
  {-# inline (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup ()`
   type `() -> () -> ()`
   executable #-}
end-instance

instance Monoidtype-class `Prelude.BasicClasses.Monoid`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.BasicClasses.Semigroup 'a () where
  define memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class instance `Monoid ()`
   type `()`
   executable := ()
  {-# inline memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class instance `Monoid ()`
   type `()`
   executable #-}
end-instance

instance Semigrouptype-class `Prelude.BasicClasses.Semigroup`
   arguments: ('a :: *) ['atype-variable `'a`
   kind `*`] where
  define (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup ['a]`
   type `['a] -> ['a] -> ['a]`
   executable := (++)constant `Prelude.List.(++)`
   constant
   type `['a] -> ['a] -> ['a]`
   executable
  {-# inline (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup ['a]`
   type `['a] -> ['a] -> ['a]`
   executable #-}
end-instance

instance Monoidtype-class `Prelude.BasicClasses.Monoid`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.BasicClasses.Semigroup 'a ['atype-variable `'a`
   kind `*`] where
  define memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class instance `Monoid ['a]`
   type `['a]`
   executable := []
  {-# inline memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class instance `Monoid ['a]`
   type `['a]`
   executable #-}
end-instance

instance Semigrouptype-class `Prelude.BasicClasses.Semigroup`
   arguments: ('a :: *) Orderingdatatype `Prelude.Ord.Ordering`
   kind `*`
   executable where
  define (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup Ordering`
   type `Ordering -> Ordering -> Ordering`
   executable LTconstant `Prelude.Ord.LT`
   constructor of datatype `Ordering`
   type `Ordering`
   executable _ := LTconstant `Prelude.Ord.LT`
   constructor of datatype `Ordering`
   type `Ordering`
   executable
       | (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup Ordering`
   type `Ordering -> Ordering -> Ordering`
   executable EQconstant `Prelude.Ord.EQ`
   constructor of datatype `Ordering`
   type `Ordering`
   executable ovariable `o`
   type `Ordering` := ovariable `o`
   type `Ordering`
       | (<>)constant `Prelude.BasicClasses.(<>)`
   constant of type-class instance `Semigroup Ordering`
   type `Ordering -> Ordering -> Ordering`
   executable GTconstant `Prelude.Ord.GT`
   constructor of datatype `Ordering`
   type `Ordering`
   executable _ := GTconstant `Prelude.Ord.GT`
   constructor of datatype `Ordering`
   type `Ordering`
   executable
end-instance

instance Monoidtype-class `Prelude.BasicClasses.Monoid`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.BasicClasses.Semigroup 'a Orderingdatatype `Prelude.Ord.Ordering`
   kind `*`
   executable where
  define memptyconstant `Prelude.BasicClasses.mempty`
   constant of type-class instance `Monoid Ordering`
   type `Ordering`
   executable := EQconstant `Prelude.Ord.EQ`
   constructor of datatype `Ordering`
   type `Ordering`
   executable
end-instance


instance (!Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*`, !Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum 'btype-variable `'b`
   kind `*`) => Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum ('atype-variable `'a`
   kind `*`, 'btype-variable `'b`
   kind `*`) where
  define universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   constant of type-class instance `(!Finite 'a, !Finite 'b) => Finite ('a, 'b)`
   type `('acc -> Bool) -> ('acc -> ('a, 'b) -> 'acc) -> 'acc -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> ('a, 'b) -> 'acc` :=
      universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable
   type-class instance from context abvariable `ab`
   type `'acc -> Bool` (fntype `'acc -> 'a -> 'acc` accvariable `acc`
   type `'acc` avariable `a`
   type `'a` -> universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `('acc -> Bool) -> ('acc -> 'b -> 'acc) -> 'acc -> 'acc`
   executable
   type-class instance from context abvariable `ab`
   type `'acc -> Bool` (fntype `'acc -> 'b -> 'acc` acc'variable `acc'`
   type `'acc` bvariable `b`
   type `'b` -> fvariable `f`
   type `'acc -> ('a, 'b) -> 'acc` acc'variable `acc'`
   type `'acc` (avariable `a`
   type `'a`, bvariable `b`
   type `'b`)) accvariable `acc`
   type `'acc`)
  {-# inline universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   constant of type-class instance `(!Finite 'a, !Finite 'b) => Finite ('a, 'b)`
   type `('acc -> Bool) -> ('acc -> ('a, 'b) -> 'acc) -> 'acc -> 'acc`
   executable #-}
end-instance

template BuildFiniteTupleInstance (n :: Nat) := '''
{{ name-scope {
     var tyVarstemplate-variable `tyVars`
   type [String] := !GetTypeVarstemplate `Prelude.Template.GetTypeVars`
   argument-type: Nat
   return-type: [String]
   does not compute text(ntemplate-variable `n`
   type Nat);
     var xstemplate-variable `xs`
   type [String] := generateNames("x", ntemplate-variable `n`
   type Nat);
   }
   var supertemplate-variable `super`
   type [String] := [] :: [String];
   foreach var tyVtemplate-variable `tyV`
   type String in tyVarstemplate-variable `tyVars`
   type [String] {
     supertemplate-variable `super`
   type [String] := insertAtEnd("!Finite " ++ tyVtemplate-variable `tyV`
   type String, supertemplate-variable `super`
   type [String]);
   }

   var insttemplate-variable `inst`
   type String := "Finite " ++ !BuildTupletemplate `Prelude.Template.BuildTuple`
   argument-type: [String]
   return-type: String
   does not compute text(tyVarstemplate-variable `tyVars`
   type [String]);
   var mtemplate-variable `m`
   type Nat := ntemplate-variable `n`
   type Nat / 2;
}}
{{! BuildInstanceHeadertemplate `Prelude.Template.BuildInstanceHeader`
   argument-types: ([String], String)
   return-type: -(supertemplate-variable `super`
   type [String], insttemplate-variable `inst`
   type String) !}}
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ({{= !BuildTupletemplate `Prelude.Template.BuildTuple`
   argument-type: [String]
   return-type: String
   does not compute text(take(mtemplate-variable `m`
   type Nat, xstemplate-variable `xs`
   type [String])) =}}, {{= !BuildTupletemplate `Prelude.Template.BuildTuple`
   argument-type: [String]
   return-type: String
   does not compute text(drop(mtemplate-variable `m`
   type Nat, xstemplate-variable `xs`
   type [String])) =}}) -> f acc {{= !BuildTupletemplate `Prelude.Template.BuildTuple`
   argument-type: [String]
   return-type: String
   does not compute text(xstemplate-variable `xs`
   type [String]) =}})
  \{-# INLINE universeFoldWithAbort #-\}
end-instance
'''

generate-codegenerated code:

instance (!Finite 'a, !Finite 'b, !Finite 'c) => Finite ('a, 'b, 'c) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc (x1, (x2, x3)) -> f acc (x1, x2, x3))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd) => Finite ('a, 'b, 'c, 'd) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2), (x3, x4)) -> f acc (x1, x2, x3, x4))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e) => Finite ('a, 'b, 'c, 'd, 'e) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2), (x3, x4, x5)) -> f acc (x1, x2, x3, x4, x5))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e, !Finite 'f) => Finite ('a, 'b, 'c, 'd, 'e, 'f) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2, x3), (x4, x5, x6)) -> f acc (x1, x2, x3, x4, x5, x6))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e, !Finite 'f, !Finite 'g) => Finite ('a, 'b, 'c, 'd, 'e, 'f, 'g) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2, x3), (x4, x5, x6, x7)) -> f acc (x1, x2, x3, x4, x5, x6, x7))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e, !Finite 'f, !Finite 'g, !Finite 'h) => Finite ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2, x3, x4), (x5, x6, x7, x8)) -> f acc (x1, x2, x3, x4, x5, x6, x7, x8))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e, !Finite 'f, !Finite 'g, !Finite 'h, !Finite 'i) => Finite ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2, x3, x4), (x5, x6, x7, x8, x9)) -> f acc (x1, x2, x3, x4, x5, x6, x7, x8, x9))
  {-# INLINE universeFoldWithAbort #-}
end-instance

instance (!Finite 'a, !Finite 'b, !Finite 'c, !Finite 'd, !Finite 'e, !Finite 'f, !Finite 'g, !Finite 'h, !Finite 'i, !Finite 'j) => Finite ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'j) where
  define universeFoldWithAbort ab f :=
    universeFoldWithAbort ab (fn acc ((x1, x2, x3, x4, x5), (x6, x7, x8, x9, x10)) -> f acc (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10))
  {-# INLINE universeFoldWithAbort #-}
end-instance

 '''
  {{% for var itemplate-variable `i`
   type Nat := 3 to 10 %}}
  {{! BuildFiniteTupleInstancetemplate `Prelude.BasicClasses.BuildFiniteTupleInstance`
   argument-type: Nat
   return-type: -(itemplate-variable `i`
   type Nat) !}}

  {{% end-for %}}'''


instance Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum () where
  define universeListconstant `Prelude.BasicClasses.universeList`
   constant of type-class instance `Finite ()`
   type `[()]`
   executable := [()]
  define universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   constant of type-class instance `Finite ()`
   type `('acc -> Bool) -> ('acc -> () -> 'acc) -> 'acc -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> () -> 'acc` avariable `a`
   type `'acc` :=
    if abvariable `ab`
   type `'acc -> Bool` avariable `a`
   type `'acc` then avariable `a`
   type `'acc` else fvariable `f`
   type `'acc -> () -> 'acc` avariable `a`
   type `'acc` ()
end-instance

instance !Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*` => Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum (Maybedatatype `Prelude.Maybe.Maybe`
   kind `* -> *`
   executable 'atype-variable `'a`
   kind `*`) where
  define universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   constant of type-class instance `!Finite 'a => Finite (Maybe 'a)`
   type `('acc -> Bool) -> ('acc -> Maybe 'a -> 'acc) -> 'acc -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> Maybe 'a -> 'acc` avariable `a`
   type `'acc` :=
    if abvariable `ab`
   type `'acc -> Bool` avariable `a`
   type `'acc` then avariable `a`
   type `'acc` else
      universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable
   type-class instance from context abvariable `ab`
   type `'acc -> Bool` (fntype `'acc -> 'a -> 'acc` accvariable `acc`
   type `'acc` vvariable `v`
   type `'a` -> fvariable `f`
   type `'acc -> Maybe 'a -> 'acc` accvariable `acc`
   type `'acc` (Justconstant `Prelude.Maybe.Just`
   constructor of datatype `Maybe`
   type `'a -> Maybe 'a`
   executable vvariable `v`
   type `'a`)) (fvariable `f`
   type `'acc -> Maybe 'a -> 'acc` avariable `a`
   type `'acc` Nothingconstant `Prelude.Maybe.Nothing`
   constructor of datatype `Maybe`
   type `Maybe 'a`
   executable)
end-instance

instance (!Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum 'atype-variable `'a`
   kind `*`, !Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum 'btype-variable `'b`
   kind `*`)  => Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum (Eitherdatatype `Prelude.Either.Either`
   kind `* -> * -> *`
   executable 'atype-variable `'a`
   kind `*` 'btype-variable `'b`
   kind `*`) where
  define universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   constant of type-class instance `(!Finite 'a, !Finite 'b) => Finite (Either 'a 'b)`
   type `('acc -> Bool) -> ('acc -> Either 'a 'b -> 'acc) -> 'acc -> 'acc`
   executable abvariable `ab`
   type `'acc -> Bool` fvariable `f`
   type `'acc -> Either 'a 'b -> 'acc` avariable `a`
   type `'acc` :=
    universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   executable
   type-class instance from context abvariable `ab`
   type `'acc -> Bool` (fntype `'acc -> 'a -> 'acc` accvariable `acc`
   type `'acc` vvariable `v`
   type `'a` -> fvariable `f`
   type `'acc -> Either 'a 'b -> 'acc` accvariable `acc`
   type `'acc` (Leftconstant `Prelude.Either.Left`
   constructor of datatype `Either`
   type `'a -> Either 'a 'b`
   executable vvariable `v`
   type `'a`)) $constant `Prelude.Function.($)`
   constant
   type `('a -> 'b) -> 'a -> 'b`
   type in context `('acc -> 'acc) -> 'acc -> 'acc`
   executable
      universeFoldWithAbortconstant `Prelude.BasicClasses.universeFoldWithAbort`
   statically resolved constant of type-class `Finite`
   type `('acc -> Bool) -> ('acc -> 'a -> 'acc) -> 'acc -> 'acc`
   type in context `('acc -> Bool) -> ('acc -> 'b -> 'acc) -> 'acc -> 'acc`
   executable
   type-class instance from context abvariable `ab`
   type `'acc -> Bool` (fntype `'acc -> 'b -> 'acc` accvariable `acc`
   type `'acc` vvariable `v`
   type `'b` -> fvariable `f`
   type `'acc -> Either 'a 'b -> 'acc` accvariable `acc`
   type `'acc` (Rightconstant `Prelude.Either.Right`
   constructor of datatype `Either`
   type `'b -> Either 'a 'b`
   executable vvariable `v`
   type `'b`)) avariable `a`
   type `'acc`
end-instance



template DeriveInstanceEnumSimpleEnumDatatypeBody (_ :: ClassID, ty :: TypeID, _ :: [String]) := '''
{{ if (not (!IsSimpleEnumDatatypetemplate `Prelude.Template.IsSimpleEnumDatatype`
   argument-type: TypeID
   return-type: Bool
   does not compute text(tytemplate-variable `ty`
   type TypeID))) {
      error("This template only works for simple enumeration types");
   }
   var constrstemplate-variable `constrs`
   type [ConstID] := tytemplate-variable `ty`
   type TypeID.constructors;
   var maxIndtemplate-variable `maxInd`
   type Nat := constrstemplate-variable `constrs`
   type [ConstID].length - 1;
}}
define fromEnum {{
  for var postemplate-variable `pos`
   type Nat := 0 to maxIndtemplate-variable `maxInd`
   type Nat {
    if (postemplate-variable `pos`
   type Nat > 0) print("     | fromEnum ");
    println(constrstemplate-variable `constrs`
   type [ConstID][postemplate-variable `pos`
   type Nat] ++ " := " ++ postemplate-variable `pos`
   type Nat);
  }
}}
define toEnum {{
  for var postemplate-variable `pos`
   type Nat := 0 to maxIndtemplate-variable `maxInd`
   type Nat {
    if (postemplate-variable `pos`
   type Nat > 0) print("     | toEnum ");
    println(postemplate-variable `pos`
   type Nat ++ " := Just " ++ constrstemplate-variable `constrs`
   type [ConstID][postemplate-variable `pos`
   type Nat]);
  }
  println("     | toEnum _ := Nothing")
}}
define succ {{
  for var postemplate-variable `pos`
   type Nat := 0 to maxIndtemplate-variable `maxInd`
   type Nat {
    if (postemplate-variable `pos`
   type Nat > 0) print("     | succ ");
    var nextPostemplate-variable `nextPos`
   type Nat := postemplate-variable `pos`
   type Nat+1;
    if (nextPostemplate-variable `nextPos`
   type Nat > maxIndtemplate-variable `maxInd`
   type Nat) nextPostemplate-variable `nextPos`
   type Nat := postemplate-variable `pos`
   type Nat;
    println(constrstemplate-variable `constrs`
   type [ConstID][postemplate-variable `pos`
   type Nat] ++ " := " ++ constrstemplate-variable `constrs`
   type [ConstID][nextPostemplate-variable `nextPos`
   type Nat]);
  }
}}
define pred {{
  for var postemplate-variable `pos`
   type Nat := 0 to maxIndtemplate-variable `maxInd`
   type Nat {
    if (postemplate-variable `pos`
   type Nat > 0) print("     | pred ");
    println(constrstemplate-variable `constrs`
   type [ConstID][postemplate-variable `pos`
   type Nat] ++ " := " ++ constrstemplate-variable `constrs`
   type [ConstID][postemplate-variable `pos`
   type Nat-1]);
  }
}}
'''

register-derive-template Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum DeriveInstanceEnumSimpleEnumDatatypeBodytemplate `Prelude.BasicClasses.DeriveInstanceEnumSimpleEnumDatatypeBody`
   argument-types: (ClassID, TypeID, [String])
   return-type: -

register-derive-template Enumtype-class `Prelude.BasicClasses.Enum`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   has default derive templates
   derive-template labels
     - simpleEnum DeriveInstanceEnumSimpleEnumDatatypeBodytemplate `Prelude.BasicClasses.DeriveInstanceEnumSimpleEnumDatatypeBody`
   argument-types: (ClassID, TypeID, [String])
   return-type: - as "simpleEnum"

template DeriveInstanceFiniteSimpleEnumDatatypeBody (_ :: ClassID, ty :: TypeID, _ :: [String]) := '''
{{ if (not (!IsSimpleEnumDatatypetemplate `Prelude.Template.IsSimpleEnumDatatype`
   argument-type: TypeID
   return-type: Bool
   does not compute text(tytemplate-variable `ty`
   type TypeID))) {
      error("This template only works for simple enumeration types");
   }
}}
define universeList := [{{= !Commafytemplate `Prelude.Template.Commafy`
   argument-type: [String]
   return-type: String
   does not compute text(tytemplate-variable `ty`
   type TypeID.constructors) =}}]
'''

register-derive-template Finitetype-class `Prelude.BasicClasses.Finite`
   arguments: ('a :: *)
   reserved var-names: 'acc
   derive-template labels
     - simpleEnum DeriveInstanceFiniteSimpleEnumDatatypeBodytemplate `Prelude.BasicClasses.DeriveInstanceFiniteSimpleEnumDatatypeBody`
   argument-types: (ClassID, TypeID, [String])
   return-type: - as "simpleEnum"


template DeriveInstanceBoundedSimpleEnumDatatypeBody (_ :: ClassID, ty :: TypeID, _ :: [String]) := '''
{{ if (not (!IsSimpleEnumDatatypetemplate `Prelude.Template.IsSimpleEnumDatatype`
   argument-type: TypeID
   return-type: Bool
   does not compute text(tytemplate-variable `ty`
   type TypeID))) {
      error("This template only works for simple enumeration types");
   }
   var constrstemplate-variable `constrs`
   type [ConstID] := tytemplate-variable `ty`
   type TypeID.constructors;
}}
define minBound := {{= constrstemplate-variable `constrs`
   type [ConstID][0] =}}
define maxBound := {{= constrstemplate-variable `constrs`
   type [ConstID][constrstemplate-variable `constrs`
   type [ConstID].length - 1] =}}
'''

register-derive-template Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum DeriveInstanceBoundedSimpleEnumDatatypeBodytemplate `Prelude.BasicClasses.DeriveInstanceBoundedSimpleEnumDatatypeBody`
   argument-types: (ClassID, TypeID, [String])
   return-type: - as "simpleEnum"


derive Orderingdatatype `Prelude.Ord.Ordering`
   kind `*`
   executable instances (Boundedtype-class `Prelude.BasicClasses.Bounded`
   arguments: ('a :: *)
   super-class constraints:
     - Prelude.Ord.Ord 'a
   derive-template labels
     - simpleEnum
generated code: instance Bounded Ordering where define minBound := LT define maxBound := GT end-instance
, Finitetype-class `Prelude.BasicClasses.Finite` arguments: ('a :: *) reserved var-names: 'acc derive-template labels - simpleEnum
generated code: instance Finite Ordering where define universeList := [LT, EQ, GT] end-instance
, Enumtype-class `Prelude.BasicClasses.Enum` arguments: ('a :: *) super-class constraints: - Prelude.Ord.Ord 'a has default derive templates derive-template labels - simpleEnum
generated code: instance Enum Ordering where define fromEnum LT := 0 | fromEnum EQ := 1 | fromEnum GT := 2 define toEnum 0 := Just LT | toEnum 1 := Just EQ | toEnum 2 := Just GT | toEnum _ := Nothing define succ LT := EQ | succ EQ := GT | succ GT := GT define pred LT := LT | pred EQ := LT | pred GT := EQ end-instance
) via "simpleEnum"
derive Booldatatype `Prelude.Bool.Bool` kind `*` executable instances (Boundedtype-class `Prelude.BasicClasses.Bounded` arguments: ('a :: *) super-class constraints: - Prelude.Ord.Ord 'a derive-template labels - simpleEnum
generated code: instance Bounded Bool where define minBound := False define maxBound := True end-instance
, Finitetype-class `Prelude.BasicClasses.Finite` arguments: ('a :: *) reserved var-names: 'acc derive-template labels - simpleEnum
generated code: instance Finite Bool where define universeList := [False, True] end-instance
, Enumtype-class `Prelude.BasicClasses.Enum` arguments: ('a :: *) super-class constraints: - Prelude.Ord.Ord 'a has default derive templates derive-template labels - simpleEnum
generated code: instance Enum Bool where define fromEnum False := 0 | fromEnum True := 1 define toEnum 0 := Just False | toEnum 1 := Just True | toEnum _ := Nothing define succ False := True | succ True := True define pred False := False | pred True := False end-instance
) via "simpleEnum"
end-moduleend of module Prelude.BasicClasses