Skip to content

Add type classes and .Instance modules declaring their instances #1332

Open
@jespercockx

Description

@jespercockx

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 #431
  • Eq (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 (from Algebra.Structures)
  • IsSemigroup (from Algebra.Structures)
  • IsMonoid (from Algebra.Structures)
  • ... (other structures from Algebra.Structures)
  • Foldable, see Add Haskell's Foldable #1099
  • TraversableA and TraversableM
  • WithDefault (for types with a "default" element), see Add WithDefault construct #1450
  • ProofIrrelevant (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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions