-
Notifications
You must be signed in to change notification settings - Fork 271
[ add ] partial elements in Effect.Monad.Partial module
#2796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
e-mniang
wants to merge
17
commits into
agda:master
Choose a base branch
from
e-mniang:partial
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−0
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6709434
Starting
e-mniang 8cdf3e1
modif path
e-mniang 55a34ee
correction
e-mniang c9c4dbe
formating file
e-mniang ddbe901
Update src/Effect/Monad/Partial.agda
JacquesCarette 52760d9
Update src/Effect/Monad/Partial.agda
JacquesCarette 802df52
Update src/Effect/Monad/Partial.agda
JacquesCarette 8c13420
refactor: make `always` and `never` more `Level`-polymorphic
jamesmckinna b56734c
refactor: make `always` more `Level`-polymorphic
jamesmckinna 0be417f
refactor: make `never` more `Level`-polymorphic
jamesmckinna cbd14d1
fix: whitespace
jamesmckinna 2e36476
refactor: code motion plus commentary
jamesmckinna 055268f
refactor: rename `elt` to `dom`
jamesmckinna a01ecc7
fix: `without-K`!
jamesmckinna 890bc14
add: `CHANGELOG` entry
jamesmckinna 62a90ec
Merge branch 'master' into partial
jamesmckinna 972d26c
add: a version of Reed's commentary
jamesmckinna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,63 @@ | ||
| ------------------------------------------------------------------------ | ||
| -- The Agda standard library | ||
| -- | ||
| -- The partial monad cf. https://1lab.dev/Data.Partial.Base.html | ||
| -- | ||
| -- Modulo proof-relevance, this defines the free pointed DCPO, | ||
| -- whereas delay-like monads, as in `Effect.Monad.Partiality`, | ||
| -- are aiming to define the free ωCPO. | ||
| -- NB. in each case, there are additional 'up to' considerations | ||
| -- wrt 'appropriate' setoid equality/quotient/bisimilarity. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably some of the PR information should also be added here). |
||
| ------------------------------------------------------------------------ | ||
|
|
||
| {-# OPTIONS --without-K --safe #-} | ||
|
|
||
| module Effect.Monad.Partial where | ||
|
|
||
| open import Level using (Level; suc; zero;_⊔_) | ||
| open import Data.Product using (_×_; Σ; Σ-syntax; _,_) | ||
| open import Data.Empty.Polymorphic using (⊥-elim; ⊥) | ||
| open import Data.Unit.Polymorphic using (⊤) | ||
|
|
||
| private | ||
| variable | ||
| a ℓ ℓ' : Level | ||
| A B : Set a | ||
|
|
||
|
|
||
| ------------------------------------------------------------------------ | ||
| -- Object part: type definition | ||
|
|
||
| record ↯ (A : Set a) (ℓ : Level) : Set (a ⊔ suc ℓ) where | ||
| field | ||
| Dom : Set ℓ | ||
| dom : Dom → A | ||
|
jamesmckinna marked this conversation as resolved.
|
||
|
|
||
| open ↯ | ||
|
|
||
| ------------------------------------------------------------------------ | ||
| -- Arrow part: Functor, Applicative, Monad component definition | ||
|
|
||
| ↯-map : (A → B) → ↯ A ℓ → ↯ B ℓ | ||
| ↯-map f a↯ .Dom = a↯ .Dom | ||
| ↯-map f a↯ .dom d = f (a↯ .dom d) | ||
|
|
||
| ↯-ap : ↯ (A → B) ℓ → ↯ A ℓ' → ↯ B (ℓ ⊔ ℓ') | ||
| ↯-ap a→b↯ a↯ .Dom = a→b↯ .Dom × a↯ .Dom | ||
| ↯-ap a→b↯ a↯ .dom (f↓ , a↓) = a→b↯ .dom f↓ (a↯ .dom a↓) | ||
|
|
||
| ↯-bind : ↯ A ℓ → (A → ↯ B ℓ') → ↯ B (ℓ ⊔ ℓ') | ||
| ↯-bind a↯ f .Dom = Σ[ a↓ ∈ a↯ .Dom ] f (a↯ .dom a↓) .Dom | ||
| ↯-bind a↯ f .dom (a↓ , fa↓) = f (a↯ .dom a↓) .dom fa↓ | ||
|
|
||
| ------------------------------------------------------------------------ | ||
| -- Specific constructions | ||
|
|
||
| never : ↯ A ℓ | ||
| never {ℓ = ℓ} .Dom = ⊥ {ℓ = ℓ} | ||
| never .dom = ⊥-elim | ||
|
|
||
| always : A → ↯ A ℓ | ||
| always {ℓ = ℓ} a .Dom = ⊤ {ℓ = ℓ} | ||
| always a .dom _ = a | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be more information here (from comments and from PR).