Use instances to simplify printing code

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
2024-03-11 12:50:05 -07:00
parent 56da61b339
commit 040c13caba
5 changed files with 78 additions and 15 deletions

View File

@@ -11,6 +11,7 @@ open import Data.Empty using (⊥-elim)
open import Data.Product using (_,_)
open import Data.Nat using (_≤_; ℕ; z≤n; s≤s; suc)
open import Function using (_∘_)
open import Showable using (Showable; show)
open import Relation.Binary.PropositionalEquality as Eq
using (_≡_; sym; subst; refl)
@@ -24,6 +25,16 @@ data AboveBelow : Set a where
⊤ : AboveBelow
[_] : A → AboveBelow
instance
showable : {{ showableA : Showable A }} → Showable AboveBelow
showable = record
{ show = (λ
{ ⊥ → "⊥"
; ⊤ → "⊤"
; [ a ] → show a
})
}
data _≈_ : AboveBelow → AboveBelow → Set a where
≈-⊥-⊥ : ⊥ ≈ ⊥
≈-⊤-⊤ : ⊤ ≈ ⊤