hafar: Affine arithmetic library for Haskell

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Hafar is an affine arithmetic library for Haskell. It is an efficient way to work with ranges of values or imprecise values.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 0.1.1.0
Change log ChangeLog.md
Dependencies base (>=4.12 && <4.14), intervals (>=0.8 && <0.9), mtl (>=2.2 && <2.3) [details]
License BSD-3-Clause
Copyright 2019 Joosep Jääger
Author Joosep Jääger
Maintainer Joosep Jääger
Category Numeric
Home page https://github.com/Soupstraw/hafar#readme
Bug tracker https://github.com/Soupstraw/hafar/issues
Source repo head: git clone https://github.com/Soupstraw/hafar
Uploaded by j_jaager at 2020-02-17T14:33:06Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hafar-0.1.0.0

[back to package description]

Hafar

Hafar is an implementation of affine arithmetic in haskell.

Building

To build the library, simply run

# stack build

or if using cabal

# cabal install --only-dependencies
# cabal build

Example

All operations with affine forms must be done inside the AFM monad.

import Numeric.Interval hiding (interval)

x1 = do
  a <- newFromInterval $ 4...6
  b <- newFromInterval $ 4...6
  return . interval $ a - b

evalAFM x1 -- evaluates to approximately -2 ... 2

x2 = do
  a <- newFromInterval $ 4...6
  return . interval $ a - a

evalAFM x2 -- evaluates to approximately 0 ... 0