@@ -10,8 +10,8 @@ module Data.Container.Combinator where
10
10
11
11
open import Level using (Level; _⊔_; lower)
12
12
open import Data.Empty.Polymorphic using (⊥; ⊥-elim)
13
- open import Data.Product.Base as P using (_,_; <_,_>; proj₁; proj₂; ∃)
14
- open import Data.Sum.Base as S using ([_,_]′)
13
+ open import Data.Product.Base as Product using (_,_; <_,_>; proj₁; proj₂; ∃)
14
+ open import Data.Sum.Base as Sum using ([_,_]′)
15
15
open import Data.Unit.Polymorphic.Base using (⊤)
16
16
import Function.Base as F
17
17
@@ -58,25 +58,25 @@ module _ {s₁ s₂ p₁ p₂} (C₁ : Container s₁ p₁) (C₂ : Container s
58
58
_∘_ .Position = ◇ C₁ (Position C₂)
59
59
60
60
to-∘ : ∀ {a} {A : Set a} → ⟦ C₁ ⟧ (⟦ C₂ ⟧ A) → ⟦ _∘_ ⟧ A
61
- to-∘ (s , f) = ((s , proj₁ F.∘ f) , P .uncurry (proj₂ F.∘ f) F.∘′ ◇.proof)
61
+ to-∘ (s , f) = ((s , proj₁ F.∘ f) , Product .uncurry (proj₂ F.∘ f) F.∘′ ◇.proof)
62
62
63
63
from-∘ : ∀ {a} {A : Set a} → ⟦ _∘_ ⟧ A → ⟦ C₁ ⟧ (⟦ C₂ ⟧ A)
64
- from-∘ ((s , f) , g) = (s , < f , P .curry (g F.∘′ any) >)
64
+ from-∘ ((s , f) , g) = (s , < f , Product .curry (g F.∘′ any) >)
65
65
66
66
-- Product. (Note that, up to isomorphism, this is a special case of
67
67
-- indexed product.)
68
68
69
69
infixr 2 _×_
70
70
71
71
_×_ : Container (s₁ ⊔ s₂) (p₁ ⊔ p₂)
72
- _×_ .Shape = Shape C₁ P .× Shape C₂
73
- _×_ .Position = P .uncurry λ s₁ s₂ → (Position C₁ s₁) S .⊎ (Position C₂ s₂)
72
+ _×_ .Shape = Shape C₁ Product .× Shape C₂
73
+ _×_ .Position = Product .uncurry λ s₁ s₂ → (Position C₁ s₁) Sum .⊎ (Position C₂ s₂)
74
74
75
- to-× : ∀ {a} {A : Set a} → ⟦ C₁ ⟧ A P .× ⟦ C₂ ⟧ A → ⟦ _×_ ⟧ A
75
+ to-× : ∀ {a} {A : Set a} → ⟦ C₁ ⟧ A Product .× ⟦ C₂ ⟧ A → ⟦ _×_ ⟧ A
76
76
to-× ((s₁ , f₁) , (s₂ , f₂)) = ((s₁ , s₂) , [ f₁ , f₂ ]′)
77
77
78
- from-× : ∀ {a} {A : Set a} → ⟦ _×_ ⟧ A → ⟦ C₁ ⟧ A P .× ⟦ C₂ ⟧ A
79
- from-× ((s₁ , s₂) , f) = ((s₁ , f F.∘ S .inj₁) , (s₂ , f F.∘ S .inj₂))
78
+ from-× : ∀ {a} {A : Set a} → ⟦ _×_ ⟧ A → ⟦ C₁ ⟧ A Product .× ⟦ C₂ ⟧ A
79
+ from-× ((s₁ , s₂) , f) = ((s₁ , f F.∘ Sum .inj₁) , (s₂ , f F.∘ Sum .inj₂))
80
80
81
81
-- Indexed product.
82
82
@@ -87,7 +87,7 @@ module _ {i s p} (I : Set i) (Cᵢ : I → Container s p) where
87
87
Π .Position = λ s → ∃ λ i → Position (Cᵢ i) (s i)
88
88
89
89
to-Π : ∀ {a} {A : Set a} → (∀ i → ⟦ Cᵢ i ⟧ A) → ⟦ Π ⟧ A
90
- to-Π f = (proj₁ F.∘ f , P .uncurry (proj₂ F.∘ f))
90
+ to-Π f = (proj₁ F.∘ f , Product .uncurry (proj₂ F.∘ f))
91
91
92
92
from-Π : ∀ {a} {A : Set a} → ⟦ Π ⟧ A → ∀ i → ⟦ Cᵢ i ⟧ A
93
93
from-Π (s , f) = λ i → (s i , λ p → f (i , p))
@@ -108,15 +108,15 @@ module _ {s₁ s₂ p} (C₁ : Container s₁ p) (C₂ : Container s₂ p) where
108
108
infixr 1 _⊎_
109
109
110
110
_⊎_ : Container (s₁ ⊔ s₂) p
111
- _⊎_ .Shape = (Shape C₁ S .⊎ Shape C₂)
111
+ _⊎_ .Shape = (Shape C₁ Sum .⊎ Shape C₂)
112
112
_⊎_ .Position = [ Position C₁ , Position C₂ ]′
113
113
114
- to-⊎ : ∀ {a} {A : Set a} → ⟦ C₁ ⟧ A S .⊎ ⟦ C₂ ⟧ A → ⟦ _⊎_ ⟧ A
115
- to-⊎ = [ P .map S .inj₁ F.id , P .map S .inj₂ F.id ]′
114
+ to-⊎ : ∀ {a} {A : Set a} → ⟦ C₁ ⟧ A Sum .⊎ ⟦ C₂ ⟧ A → ⟦ _⊎_ ⟧ A
115
+ to-⊎ = [ Product .map Sum .inj₁ F.id , Product .map Sum .inj₂ F.id ]′
116
116
117
- from-⊎ : ∀ {a} {A : Set a} → ⟦ _⊎_ ⟧ A → ⟦ C₁ ⟧ A S .⊎ ⟦ C₂ ⟧ A
118
- from-⊎ (S .inj₁ s₁ , f) = S .inj₁ (s₁ , f)
119
- from-⊎ (S .inj₂ s₂ , f) = S .inj₂ (s₂ , f)
117
+ from-⊎ : ∀ {a} {A : Set a} → ⟦ _⊎_ ⟧ A → ⟦ C₁ ⟧ A Sum .⊎ ⟦ C₂ ⟧ A
118
+ from-⊎ (Sum .inj₁ s₁ , f) = Sum .inj₁ (s₁ , f)
119
+ from-⊎ (Sum .inj₂ s₂ , f) = Sum .inj₂ (s₂ , f)
120
120
121
121
-- Indexed sum.
122
122
0 commit comments