Debian Codegraph @

src/Function/Identity/Effectful.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- An effectful view of the identity function
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 module Function.Identity.Effectful where
10
11 open import Effect.Functor using (RawFunctor)
12 open import Effect.Applicative using (RawApplicative)
13 open import Effect.Monad using (RawMonad)
14 open import Effect.Comonad using (RawComonad)
15 open import Function.Base using (id; _∘′_; _|>′_; _$′_; flip)
16 open import Level using (Level; _⊔_)
17
18 private
19 variable
20 ℓ : Level
21
22 Identity : (A : Set ℓ) → Set ℓ
23 Identity A = A
24
25 functor : RawFunctor {ℓ} Identity
26 functor = record
27 { _<$>_ = id
28 }
29
30 applicative : RawApplicative {ℓ} Identity
31 applicative = record
32 { rawFunctor = functor
33 ; pure = id
34 ; _<*>_ = _$′_
35 }
36
37 monad : RawMonad {ℓ} Identity
38 monad = record
39 { rawApplicative = applicative
40 ; _>>=_ = _|>′_
41 }
42
43 comonad : RawComonad {ℓ} Identity
44 comonad = record
45 { extract = id
46 ; extend = _$′_
47 }