numhask: numeric classes

[ bsd3, library, mathematics ] [ Propose Tags ]

A numeric class heirarchy.


[Skip to Readme]
Versions [faq] 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.2.3.0, 0.2.3.1, 0.3.0.0, 0.3.1, 0.4.0, 0.5.0, 0.6.0, 0.6.0.1, 0.6.0.2
Dependencies base (>=4.7 && <5), bifunctors (>=3.2), mmorph (>=1.1), protolude (==0.3.*), text (>=1.2), transformers (>=0.5) [details]
License BSD-3-Clause
Copyright Tony Day
Author Tony Day
Maintainer tonyday567@gmail.com
Category mathematics
Home page https://github.com/tonyday567/numhask#readme
Bug tracker https://github.com/tonyday567/numhask/issues
Source repo head: git clone https://github.com/tonyday567/numhask(numhask)
Uploaded by tonyday567 at 2020-07-16T23:53:19Z
Distributions NixOS:0.6.0.2, Stackage:0.3.0.0
Downloads 10863 total (89 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2020-07-17 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for numhask-0.6.0.2

[back to package description]

numhask

Build Status Gitter chat

A numeric class hierarchy, providing a structure for numbers and functions that combine them.

Field hierarchy

Field Hierarchy

NumHask class structure

NumHask Hierarchy

numhask begins with separately named magma-derived classes for addition and multiplication, and then being symetrical in the treatment of the two heirarchies. A short magma structure is provided with the intention of supplying appropriate classes for operators that are neither addition nor multiplication, but this structure is not hooked up to the main classes.

To be as compatible as practical with the existing haskell ecosystem. Ints, Integers, Floats, Doubles and Complex are taken from base and given numhask class instances, so they are also Num instances. Monoid and Semigroup are not used in numhask to maintain compatability.

numhask replaces all the relevant numeric operators in Prelude, so you're going to get clashes.

QuickCheck tests of numeric laws are included. This also includes tracking where laws are approximate or fail for non-exact numbers.

The usual operators (+) and (*) operators are reserved for commutative relationships, with plus and times being used for non-commutative ones.

In summary, the library doesn't do anything fancy. But if having to define (*) when you just want a (+) offends your sensibilities, it may bring some sanity.

NumHask.Prelude

{-# LANGUAGE NoImplicitPrelude #-}
import NumHask.Prelude

'Numhask.Prelude' is designed as a drop-in replacement for Prelude and 'NoImplicitPrelude' is obligatory. Behind the scenes, the module wraps protolude.