Debian Codegraph @

src/Data/Product/Effectful/Left/Base.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Base definitions for the left-biased universe-sensitive functor and
5 -- 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.Left.Base
18 {a} (A : Set a) (b : 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ₗ B = A × B
29
30 functor : RawFunctor Productₗ
31 functor = record { _<$>_ = λ f → map₂ f }
32
33 comonad : RawComonad Productₗ
34 comonad = record
35 { extract = proj₂
36 ; extend = < proj₁ ,_>
37 }