-
Notifications
You must be signed in to change notification settings - Fork 257
Add new module Effect.Functor.Naperian
- Continuation of #2004
#2815
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
gabriellisboaconegero
wants to merge
20
commits into
agda:master
Choose a base branch
from
gabriellisboaconegero:functor_naperian
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.
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1a86ef4
Upload new file Effect.Functor.Naperian to stdlib
Sofia-Insa 0dd5051
Update CHANGELOG.md
Sofia-Insa af6d2dc
Merge branch 'task2-Naperian' of https://github.com/Sofia-Insa/agda-s…
Sofia-Insa eba481c
Update CHANGELOG.md
Sofia-Insa 603483f
updated `CHANGELOG`
jamesmckinna 7dcb115
added note
jamesmckinna d76c8df
Merge branch 'master' into task2-Naperian
jamesmckinna 73bd5bd
hopefully now fixed merge conflict with up-to-date `CHANGELOG`
jamesmckinna e233f0e
restored original details to `CHANGELOG`
jamesmckinna ad30c67
review comments from me
jamesmckinna 775560f
Merge branch 'master' into task2-Naperian
JacquesCarette 6804ecd
Setoid version of Naperian -- needs another pair of eyes.
JacquesCarette a1de89f
whitespace
JacquesCarette 527e4d7
[FIX]: Naming + Propositional Naperian
gabriellisboaconegero 3c478d3
[REFAC]: RawFunctor as part of RawNaperian + james revision
gabriellisboaconegero d697f2c
Merge branch 'master' into functor_naperian
gabriellisboaconegero 0741736
[DOC]: Update CHANGELOG
gabriellisboaconegero 5216bbb
[ADD]: Vec n is Naperian; rawNaperian to rawApplicative
gabriellisboaconegero ffda892
[NAMING]: Correct naming in Vec.Effectful and Naperian
gabriellisboaconegero 6ad71f0
[NAMING]: ETA contract
gabriellisboaconegero 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,17 @@ open import Data.Vec.Base as Vec hiding (_⊛_) | |
open import Data.Vec.Properties | ||
open import Effect.Applicative as App using (RawApplicative) | ||
open import Effect.Functor as Fun using (RawFunctor) | ||
open import Effect.Functor.Naperian as Nap using (RawNaperian; PropositionalNaperian) | ||
open import Effect.Monad using (RawMonad; module Join; RawMonadT; mkRawMonad) | ||
import Function.Identity.Effectful as Id | ||
open import Function.Base using (flip; _∘_) | ||
open import Level using (Level) | ||
open import Level using (Level; 0ℓ) | ||
open import Relation.Binary.Bundles using (Setoid) | ||
open import Relation.Binary.PropositionalEquality | ||
|
||
private | ||
variable | ||
a : Level | ||
a b : Level | ||
A : Set a | ||
n : ℕ | ||
|
||
|
@@ -33,6 +36,22 @@ functor = record | |
{ _<$>_ = map | ||
} | ||
|
||
naperian : RawNaperian (λ (A : Set a) → Vec A n) 0ℓ | ||
naperian {n = n} = record | ||
{ rawFunctor = functor | ||
; Log = Fin n | ||
; index = lookup | ||
; tabulate = tabulate | ||
} | ||
|
||
fullNaperian : PropositionalNaperian (λ (A : Set a) → Vec A n) 0ℓ | ||
fullNaperian A = record | ||
{ rawNaperian = naperian | ||
; index-tabulate = λ f l → lookup∘tabulate f l | ||
|
||
; natural-tabulate = λ f k l → cong (λ fx → lookup fx l) (tabulate-∘ f k) | ||
; natural-index = λ f as l → lookup-map l f as | ||
} | ||
|
||
applicative : RawApplicative (λ (A : Set a) → Vec A n) | ||
applicative {n = n} = record | ||
{ rawFunctor = functor | ||
|
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -15,10 +15,11 @@ | |||||||||
module Effect.Functor.Naperian where | ||||||||||
|
||||||||||
open import Effect.Functor using (RawFunctor) | ||||||||||
open import Effect.Applicative using (RawApplicative) | ||||||||||
open import Level using (Level; suc; _⊔_) | ||||||||||
open import Relation.Binary.Bundles using (Setoid) | ||||||||||
open import Relation.Binary.PropositionalEquality.Properties as ≡ using (setoid) | ||||||||||
open import Function.Base using (_∘_) | ||||||||||
open import Function.Base using (_∘_; const) | ||||||||||
|
||||||||||
private | ||||||||||
variable | ||||||||||
|
@@ -69,3 +70,13 @@ module _ (F : Set a → Set b) c where | |||||||||
|
||||||||||
PropositionalNaperian : Set (suc (a ⊔ c) ⊔ b) | ||||||||||
PropositionalNaperian = ∀ A → Naperian (≡.setoid A) | ||||||||||
|
||||||||||
Naperian-Applicative : RawNaperian → RawApplicative F | ||||||||||
Naperian-Applicative rn = | ||||||||||
|
Naperian-Applicative : RawNaperian → RawApplicative F | |
Naperian-Applicative rn = | |
rawApplicative : RawNaperian → RawApplicative F | |
rawApplicative rn = |
on our 'usual' naming model?
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.
I think I would name this
rawNaperian
and the one belownaperian
.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.
Similarly:
rawApplicative
below... etc.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.
Changing the naming of
naperian
was easy. However, changingapplicative
torawApplicative
caused problems with the moduleTraversableM
, as it attempts to open therawApplicative
inside theRawMonad
, which can conflict with the naming.The way I found was to explicitly extract the
rawApplicative
fromRawMonad
withopen TraversableA (RawMonad.rawApplicative Mon) public