Skip to content

Commit

Permalink
Merge pull request #45 from m0davis/master
Browse files Browse the repository at this point in the history
use record instead of data for Σ
  • Loading branch information
UlfNorell committed Nov 9, 2016
2 parents 4ee0fd2 + 076b760 commit b228399
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/Prelude/Product.agda
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ open import Prelude.Decidable
open import Prelude.Ord

infixr 1 _,_
data Σ {a b} (A : Set a) (B : A Set b) : Set (a ⊔ b) where
_,_ : (x : A) (y : B x) Σ A B
record Σ {a b} (A : Set a) (B : A Set b) : Set (a ⊔ b) where
no-eta-equality
constructor _,_
field
fst : A
snd : B fst

open Σ public

instance
ipair : {a b} {A : Set a} {B : A Set b} {{x : A}} {{y : B x}} Σ A B
ipair {{x}} {{y}} = x , y

fst : {a b} {A : Set a} {B : A Set b} Σ A B A
fst (x , y) = x

snd : {a b} {A : Set a} {B : A Set b} (p : Σ A B) B (fst p)
snd (x , y) = y

infixr 3 _×_
_×_ : {a b} Set a Set b Set (a ⊔ b)
A × B = Σ A (λ _ B)
Expand Down
6 changes: 5 additions & 1 deletion src/Tactic/Reflection/Quote.agda
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ unquoteDecl QuotableBool = deriveQuotable QuotableBool (quote Bool)
unquoteDecl QuotableList = deriveQuotable QuotableList (quote List)
unquoteDecl QuotableMaybe = deriveQuotable QuotableMaybe (quote Maybe)
unquoteDecl QuotableEither = deriveQuotable QuotableEither (quote Either)
unquoteDecl QuotableΣ = deriveQuotable QuotableΣ (quote Σ)

instance
QuotableΣ : {a b} {A : Set a} {B : A Set b} {{_ : Quotable A}} {{_ : {x : A} Quotable (B x)}} Quotable (Σ A λ a B a)
QuotableΣ = record { ` = λ { (x , y) con (quote _,_) ((vArg (` x)) ∷ vArg (` y) ∷ [])} }

unquoteDecl Quotable⊤ = deriveQuotable Quotable⊤ (quote ⊤)
unquoteDecl Quotable⊥ = deriveQuotable Quotable⊥ (quote ⊥)
unquoteDecl Quotable≡ = deriveQuotable Quotable≡ (quote _≡_)
Expand Down

0 comments on commit b228399

Please sign in to comment.