You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -144,7 +148,7 @@ Unfortunately, Agda does not allow the constructor name to be the same as the da
144
148
However, it _is_ possible to achieve this with Agda2HSif you donot explicitly add a constructor name to a record definition (this requires the use of `record { ... }` syntax on the Agda side):
145
149
146
150
```agda
147
-
record Duo (a :Set) :Setwhere
151
+
record Duo (a :Type) :Typewhere
148
152
field
149
153
duo : a × a
150
154
open Duo public
@@ -243,7 +247,7 @@ The type signatures of both `if_then_else_` and `case_of_` on the Agda side cont
243
247
244
248
This allows for the following Agda code to type check:
245
249
```agda
246
-
data Range : Set where
250
+
data Range : Type where
247
251
MkRange : (low high : Int)
248
252
→ {{ @0 h : ((low <= high) ≡ True) }}
249
253
→ Range
@@ -303,7 +307,7 @@ Parameters can be annotated with a _quantity_ of either `0` or `ω` (the default
@@ -351,7 +355,7 @@ To construct an instance of a type class, you can simply do the following:
351
355
352
356
Agda:
353
357
```agda
354
-
record Circle : Set where
358
+
record Circle : Type where
355
359
constructor MkCircle
356
360
field
357
361
radius : Int
@@ -379,7 +383,7 @@ In this case, you can also implement the `IsLawful` instance for the data type a
379
383
380
384
Agda:
381
385
```agda
382
-
record Equal (a : Set) : Set where
386
+
record Equal (a : Type) : Type where
383
387
constructor MkEqual
384
388
field
385
389
pair : a × a
@@ -425,17 +429,17 @@ constructEqualCircle c d = constructEqual c d
425
429
426
430
Agda:
427
431
```agda
428
-
record Class1 (a : Set) : Set where
432
+
record Class1 (a : Type) : Type where
429
433
field
430
434
field1 : a
431
435
{-# COMPILE AGDA2HS Class1 class #-}
432
436
433
-
record Class2 (a : Set) : Set where
437
+
record Class2 (a : Type) : Type where
434
438
field
435
439
field2 : a
436
440
{-# COMPILE AGDA2HS Class2 class #-}
437
441
438
-
class1-implies-class2 (a : Set) : Class1 a → Class2 a
442
+
class1-implies-class2 (a : Type) : Class1 a → Class2 a
439
443
class1-implies-class2 _ class1 = record { field2 = class1.field1 }
440
444
{-# COMPILE AGDA2HS class1-implies-class2 #-}
441
445
```
@@ -456,12 +460,12 @@ instance Class1 a => Class2 a where
456
460
457
461
Agda:
458
462
```agda
459
-
record Class1 (a : Set) : Set where
463
+
record Class1 (a : Type) : Type where
460
464
field
461
465
field1 : a
462
466
{-# COMPILE AGDA2HS Class1 class #-}
463
467
464
-
record Class2 (a : Set) : Set where
468
+
record Class2 (a : Type) : Type where
465
469
field
466
470
overlap ⦃ super ⦄ : ClassA b
467
471
field2 : a
@@ -481,18 +485,18 @@ class Class1 a => Class2 a where
481
485
482
486
Agda:
483
487
```agda
484
-
record Ord (a :Set) :Setwhere
488
+
record Ord (a :Type) :Typewhere
485
489
field
486
490
_<_ _>_ : a → a →Bool
487
491
488
-
record Ord₁ (a :Set) :Setwhere
492
+
record Ord₁ (a :Type) :Typewhere
489
493
field
490
494
_<_ : a → a →Bool
491
495
492
496
_>_ : a → a →Bool
493
497
x > y = y < x
494
498
495
-
record Ord₂ (a :Set) :Setwhere
499
+
record Ord₂ (a :Type) :Typewhere
496
500
field
497
501
_>_ : a → a →Bool
498
502
@@ -530,7 +534,7 @@ used to define fields of typeclass instances, for example:
530
534
531
535
Agda:
532
536
```agda
533
-
record HasId (a : Set) : Set where
537
+
record HasId (a : Type) : Type where
534
538
field id : a → a
535
539
{-# COMPILE AGDA2HS HasId class #-}
536
540
@@ -553,7 +557,7 @@ instance HasId () where
553
557
If the derived instance is not needed on the Agda side and needs to only be generated in Haskell, the deriving clause can simply be added to the compilation pragma (this also works with the `newtype` pragma):
554
558
555
559
```agda
556
-
data Planet : Set where
560
+
data Planet : Type where
557
561
Mercury : Planet
558
562
Venus : Planet
559
563
Earth : Planet
@@ -618,7 +622,7 @@ This is also possible with more complicated instance definitions, such as in the
618
622
619
623
Agda:
620
624
```agda
621
-
dataOptional (a:Set) :Setwhere
625
+
dataOptional (a:Type) :Typewhere
622
626
Of:a→Optionala
623
627
Empty:Optionala
624
628
@@ -645,7 +649,7 @@ postulate instance iPlanetShow : Show Planet
@@ -210,7 +210,7 @@ isAscending (x ∷ y ∷ xs) = if x <= y then isAscending
210
210
This function can be compiled to Haskell without any issue, however, when you try using it in proofs you can notice that it is not the most handy definition: since the different cases are anonymous, invoking them is not straightforward and might require defining more proof cases with additional assertions about the values input data (an example of which can be found [further in the tutorial](function-example)) A better definition might be a predicate, instead:
211
211
212
212
```agda
213
-
data IsAscending₂ {a : Set} ⦃ iOrdA : Ord a ⦄ : List a → Set where
213
+
data IsAscending₂ {a : Type} ⦃ iOrdA : Ord a ⦄ : List a → Type where
0 commit comments