-
Notifications
You must be signed in to change notification settings - Fork 248
Add Number
literals for any SuccessorSet
#2406
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3af63d7
fixes #1363
jamesmckinna 3d6d252
review comments; weaken the input interface to `RawSuccessorSet`
jamesmckinna 75dbd7b
remove `instance`; future-proof by making `fromℕ` local
jamesmckinna e79b1f8
fix `CHANGELOG`
jamesmckinna af5c184
update `CHANGELOG`
jamesmckinna 00fd3f3
fix `CHANGELOG`
jamesmckinna 7a5ce6d
Merge branch 'agda:master' into algebra-literals
jamesmckinna fc9e3b8
update `CHANGELOG`
jamesmckinna ea67568
Merge branch 'master' into algebra-literals
jamesmckinna 2f9d65b
Merge branch 'master' into algebra-literals
jamesmckinna 8f1aec0
Merge branch 'agda:master' into algebra-literals
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
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
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,29 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- Algebra Literals, from a SuccessorSet | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
open import Algebra.Bundles using (SuccessorSet) | ||
|
||
module Algebra.Literals {c ℓ} (successorSet : SuccessorSet c ℓ) where | ||
|
||
open import Agda.Builtin.FromNat using (Number) | ||
open import Data.Nat.Base as ℕ using (ℕ; zero; suc) | ||
open import Data.Unit.Polymorphic.Base | ||
|
||
open SuccessorSet successorSet | ||
|
||
|
||
------------------------------------------------------------------------ | ||
-- Number instance | ||
|
||
fromℕ : (n : ℕ) → Carrier | ||
fromℕ zero = zero# | ||
fromℕ (suc n) = suc# (fromℕ n) | ||
|
||
instance | ||
gallais marked this conversation as resolved.
Show resolved
Hide resolved
|
||
number : Number Carrier | ||
number = record { Constraint = λ _ → ⊤ ; fromNat = λ n → fromℕ n } | ||
JacquesCarette marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Uh oh!
There was an error while loading. Please reload this page.