| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Base definitions for the right-biased universe-sensitive functor |
| 5 |
-- and monad instances for the Product type. |
| 6 |
-- |
| 7 |
-- To minimize the universe level of the RawFunctor, we require that |
| 8 |
-- elements of B are "lifted" to a copy of B at a higher universe level |
| 9 |
-- (a ⊔ b). See the Data.Product.Effectful.Examples for how this is |
| 10 |
-- done. |
| 11 |
------------------------------------------------------------------------ |
| 12 |
|
| 13 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 14 |
|
| 15 |
open import Level |
| 16 |
|
| 17 |
module Data.Product.Effectful.Right.Base |
| 18 |
{b} (B : Set b) (a : Level) where |
| 19 |
|
| 20 |
open import Data.Product.Base using (_×_; map₁; proj₁; proj₂; <_,_>) |
| 21 |
open import Effect.Functor using (RawFunctor) |
| 22 |
open import Effect.Comonad using (RawComonad) |
| 23 |
|
| 24 |
------------------------------------------------------------------------ |
| 25 |
-- Definitions |
| 26 |
|
| 27 |
Productᵣ : Set (a ⊔ b) → Set (a ⊔ b) |
| 28 |
Productᵣ A = A × B |
| 29 |
|
| 30 |
functor : RawFunctor Productᵣ |
| 31 |
functor = record { _<$>_ = map₁ } |
| 32 |
|
| 33 |
comonad : RawComonad Productᵣ |
| 34 |
comonad = record |
| 35 |
{ extract = proj₁ |
| 36 |
; extend = <_, proj₂ > |
| 37 |
} |