Skip to content

Commit 5515a8c

Browse files
jamesmckinnaandreasabel
authored andcommitted
refactored to lift out isEquivalence (#2382)
1 parent 618d838 commit 5515a8c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Function/Relation/Binary/Setoid/Equality.agda

+10-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module Function.Relation.Binary.Setoid.Equality {a₁ a₂ b₁ b₂ : Level}
1515
open import Function.Bundles using (Func; _⟨$⟩_)
1616
open import Relation.Binary.Definitions
1717
using (Reflexive; Symmetric; Transitive)
18+
open import Relation.Binary.Structures
19+
using (IsEquivalence)
1820

1921
private
2022
module To = Setoid To
@@ -33,17 +35,16 @@ sym = λ f≈g → To.sym f≈g
3335
trans : Transitive _≈_
3436
trans = λ f≈g g≈h To.trans f≈g g≈h
3537

36-
setoid : Setoid _ _
37-
setoid = record
38-
{ Carrier = Func From To
39-
; _≈_ = _≈_
40-
; isEquivalence = record -- need to η-expand else Agda gets confused
41-
{ refl = λ {f} refl {f}
42-
; sym = λ {f} {g} sym {f} {g}
43-
; trans = λ {f} {g} {h} trans {f} {g} {h}
44-
}
38+
isEquivalence : IsEquivalence _≈_
39+
isEquivalence = record -- need to η-expand else Agda gets confused
40+
{ refl = λ {f} refl {f}
41+
; sym = λ {f} {g} sym {f} {g}
42+
; trans = λ {f} {g} {h} trans {f} {g} {h}
4543
}
4644

45+
setoid : Setoid _ _
46+
setoid = record { isEquivalence = isEquivalence }
47+
4748
-- most of the time, this infix version is nicer to use
4849
infixr 9 _⇨_
4950
_⇨_ : Setoid _ _

0 commit comments

Comments
 (0)