-
Notifications
You must be signed in to change notification settings - Fork 246
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
Add type classes and .Instance
modules declaring their instances
#1332
Comments
See also #559 for the more general discussion on instance arguments in the standard library. |
We agreed yesterday that moving all the names like We were also discussing the question of using 'algebraic' type classes (like |
Err I'm afraid I'm not quite sure that's what I got. I thought that the conclusion was that we should have a separate module that imported everything you need for using instances + all the non-clashing original content as well. I don't think we need to go so far as to create a new common base module, which is what I think you're proposing?
I'm afraid I don't quite remember this point? I thought Oreistis was saying that that was the better solution if one didn't want to use type-classes. Personally I'm strongly in favour of the syntactic style, as the latter doesn't involve heavy-weight dependencies on the |
As I see it there are two approaches. Using
Yes, my writing was probably a bit unclear. This is a new point that came up this morning, and I'm actually still unsure about my opinion. I think I found an issue with this idea of renaming - maybe it's time to write an example module that demonstrates this issue. It might also be worth pointing out that Lean does both, it has syntactic classes like |
I have to confess I struggle to see the concrete benefits of the latter? |
During the Agda meeting, I identified the following list of typeclasses for which it would be nice to have a
.Instances
module declaring their instances (some of these would also need the typeclass itself being added to the library):Show
(turning things into strings), see Show functions for all the datatypes #431Eq
(decidable equality)Ord
(decidable ordering)Number
(types that admit natural number literals)Fractional
(types that admit floating point literals)Quotable
(types that we know how to turn into reflected syntax)IsMagma
(fromAlgebra.Structures
)IsSemigroup
(fromAlgebra.Structures
)IsMonoid
(fromAlgebra.Structures
)Algebra.Structures
)Foldable
, see Add Haskell'sFoldable
#1099TraversableA
andTraversableM
WithDefault
(for types with a "default" element), see AddWithDefault
construct #1450ProofIrrelevant
(for types with at most one element)HasHLevel
(for types of a finite h-level)The following monad transformers should also be given instances of the typeclasses they inhabit:
StateT
ReaderT
I didn't want to spam the issue tracker with new issues, so I have bundled them here into one. But it would be easy to divide this work among multiple people!
The text was updated successfully, but these errors were encountered: