Use instances to simplify printing code
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
@@ -13,13 +13,15 @@ open import Data.List.Membership.Propositional as MemProp using () renaming (_
|
||||
|
||||
open import Relation.Nullary using (¬_; Dec; yes; no)
|
||||
open import Data.Nat using (ℕ)
|
||||
open import Data.List using (List; map; []; _∷_; _++_)
|
||||
open import Data.List using (List; map; []; _∷_; _++_) renaming (foldr to foldrˡ)
|
||||
open import Data.List.Relation.Unary.All using (All; []; _∷_)
|
||||
open import Data.List.Relation.Unary.Any using (Any; here; there) -- TODO: re-export these with nicer names from map
|
||||
open import Data.Product using (_×_; _,_; Σ; proj₁ ; proj₂)
|
||||
open import Data.Empty using (⊥; ⊥-elim)
|
||||
open import Equivalence
|
||||
open import Utils using (Unique; push; Unique-append; All¬-¬Any; All-x∈xs)
|
||||
open import Data.String using () renaming (_++_ to _++ˢ_)
|
||||
open import Showable using (Showable; show)
|
||||
|
||||
open IsLattice lB using () renaming
|
||||
( ≈-refl to ≈₂-refl; ≈-sym to ≈₂-sym; ≈-trans to ≈₂-trans
|
||||
@@ -478,6 +480,14 @@ private module ImplInsert (f : B → B → B) where
|
||||
Map : Set (a ⊔ℓ b)
|
||||
Map = Σ (List (A × B)) (λ l → Unique (ImplKeys.keys l))
|
||||
|
||||
instance
|
||||
showable : {{ showableA : Showable A }} {{ showableB : Showable B }} →
|
||||
Showable Map
|
||||
showable = record
|
||||
{ show = λ (kvs , _) →
|
||||
"{" ++ˢ foldrˡ (λ (x , y) rest → show x ++ˢ " ↦ " ++ˢ show y ++ˢ ", " ++ˢ rest) "" kvs ++ˢ "}"
|
||||
}
|
||||
|
||||
empty : Map
|
||||
empty = ([] , Utils.empty)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user