-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Paulo Oliva <[email protected]>
- Loading branch information
1 parent
3ec80fa
commit 01f1ec9
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Martin Escardo, Paulo Oliva, 2024 | ||
|
||
The list monad. | ||
|
||
\begin{code} | ||
|
||
{-# OPTIONS --safe --without-K #-} | ||
|
||
module Games.List where | ||
|
||
open import Games.Monad | ||
open import MLTT.Spartan hiding (J) | ||
open import MLTT.List hiding (map) | ||
|
||
𝕃 : Monad | ||
𝕃 = record { | ||
functor = List ; | ||
η = [_] ; | ||
ext = List-ext ; | ||
ext-η = concat-singletons ; | ||
unit = List-ext-unit ; | ||
assoc = List-ext-assoc | ||
} | ||
|
||
module List-definitions where | ||
|
||
_⊗ᴸ⁺_ : {X : Type} {Y : X → Type} | ||
→ List X | ||
→ ((x : X) → List (Y x)) | ||
→ List (Σ x ꞉ X , Y x) | ||
_⊗ᴸ⁺_ = _⊗_ 𝕃 | ||
|
||
ηᴸ⁺ : {X : Type} → X → List X | ||
ηᴸ⁺ = η 𝕃 | ||
|
||
extᴸ⁺ : {X Y : Type} → (X → List Y) → List X → List Y | ||
extᴸ⁺ = ext 𝕃 | ||
|
||
mapᴸ⁺ : {X Y : Type} → (X → Y) → List X → List Y | ||
mapᴸ⁺ = map 𝕃 | ||
|
||
\end{code} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters