@@ -34,10 +34,25 @@ instance
34
34
Bifunctor-Σ .bimap′ = ×.map
35
35
36
36
-- ** non-dependent version
37
- record Bifunctor (F : Type a → Type b → Type (a ⊔ b)) : Type (lsuc (a ⊔ b)) where
37
+ Type[_∣_↝_] : ∀ ℓ ℓ′ ℓ″ → Type _
38
+ Type[ ℓ ∣ ℓ′ ↝ ℓ″ ] = Type ℓ → Type ℓ′ → Type ℓ″
39
+
40
+ Level↑² = Level → Level → Level
41
+
42
+ Type↑² : Level↑² → Typeω
43
+ Type↑² ℓ↑² = ∀ {ℓ ℓ′} → Type[ ℓ ∣ ℓ′ ↝ ℓ↑² ℓ ℓ′ ]
44
+
45
+ variable
46
+ ℓ↑² : Level → Level → Level
47
+
48
+ record Bifunctor (F : Type↑² ℓ↑²) : Typeω where
38
49
field
39
50
bimap : ∀ {A A′ : Type a} {B B′ : Type b} → (A → A′) → (B → B′) → F A B → F A′ B′
40
51
52
+ -- record Bifunctor {a}{b} (F : Type a → Type b → Type (a ⊔ b)) : Type (lsuc (a ⊔ b)) where
53
+ -- field
54
+ -- bimap : ∀ {A A′ : Type a} {B B′ : Type b} → (A → A′) → (B → B′) → F A B → F A′ B′
55
+
41
56
map₁ : ∀ {A A′ : Type a} {B : Type b} → (A → A′) → F A B → F A′ B
42
57
map₁ f = bimap f id
43
58
_<$>₁_ = map₁
@@ -50,16 +65,15 @@ record Bifunctor (F : Type a → Type b → Type (a ⊔ b)) : Type (lsuc (a ⊔
50
65
51
66
open Bifunctor ⦃...⦄ public
52
67
53
- map₁₂ : ∀ {F : Type a → Type a → Type a} {A B : Type a}
54
- → ⦃ Bifunctor F ⦄
55
- → (A → B) → F A A → F B B
68
+ map₁₂ : ∀ {F : Type↑² ℓ↑²} ⦃ _ : Bifunctor F ⦄ →
69
+ (∀ {a} {A B : Type a} → (A → B) → F A A → F B B)
56
70
map₁₂ f = bimap f f
57
71
_<$>₁₂_ = map₁₂
58
72
infixl 4 _<$>₁₂_
59
73
60
74
instance
61
- Bifunctor-× : Bifunctor {a}{b} _×_
75
+ Bifunctor-× : Bifunctor _×_
62
76
Bifunctor-× .bimap f g = ×.map f g
63
77
64
- Bifunctor-⊎ : Bifunctor {a}{b} _⊎_
78
+ Bifunctor-⊎ : Bifunctor _⊎_
65
79
Bifunctor-⊎ .bimap = ⊎.map
0 commit comments