yap: yet another prelude - a simplistic refactoring with algebraic classes

[ algebra, bsd3, library, prelude ] [ Propose Tags ] [ Report a vulnerability ]

A simple refactoring of the Prelude numeric classes, aiming to escape from the restrictive bundling of operations in the standard numeric classes, while preserving backward compatibility for clients. This is done by adding algebraic classes as superclasses of the Haskell 2010 numeric classes, yielding the following class hierarchy (grey classes are unchanged):

Prelude.YAP is an almost-compatible replacement for the standard Haskell Prelude, as long as you're not defining instances of the numeric classes (though defaulting will be affected). When importing it, use

{-# LANGUAGE RebindableSyntax #-}

This will turn off the implicit Prelude import and attach various syntax to the new definitions.

Data.YAP.Algebra contains just the new classes; you'll need to import it if you want access to the new names, including to define instances.

Other modules contain instances for the existing types Complex and Ratio. Further examples are in the yap-examples package.

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0, 0.1, 0.2, 0.3.0
Change log changelog
Dependencies base (>=4.18 && <5) [details]
License BSD-3-Clause
Author Ross Paterson <R.Paterson@city.ac.uk>
Maintainer Ross Paterson <R.Paterson@city.ac.uk>
Category Algebra, Prelude
Source repo head: git clone https://github.com/RossPaterson/yap
Uploaded by RossPaterson at 2025-07-21T16:05:59Z
Distributions NixOS:0.2
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 2597 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-07-21 [all 1 reports]