interval-functor: Intervals of functors.

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

Closed intervals in spaces described by a functor.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.0.0, 0.0.0.1
Change log CHANGELOG.md
Dependencies base (>=4.10 && <5), transformers (>=0.4 && <0.7) [details]
Tested with ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.3, ghc ==8.10.1, ghc ==9.0.1, ghc ==9.2.1, ghc ==9.4.2, ghc ==9.6.2, ghc ==9.8.2, ghc ==9.10.1
License BSD-3-Clause
Copyright 2018-2020 Rob Rix
Author Rob Rix
Maintainer rob.rix@me.com
Category Data
Home page https://github.com/robrix/interval-functor
Bug tracker https://github.com/robrix/interval-functor/issues
Source repo head: git clone https://github.com/robrix/interval-functor
Uploaded by robrix at 2024-10-04T12:53:55Z
Distributions
Downloads 348 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for interval-functor-0.0.0.1

[back to package description]

interval-functor

Hackage BSD3 license Build Status

This is a Haskell package defining an Interval datatype parameterized by the type of endpoints and the type of their coordinates. For example, it can represent a simple one-dimensional range:

import Data.Functor.Identity
import Data.Functor.Interval

zeroInterval :: Num a => Interval Identity a
zeroInterval = point 0

or a multi-dimensional region:

import Data.Functor.Interval
import Linear.V3 -- from the linear package

unitCube :: Num a => Interval V3 a
unitCube = (-1)...1

Development

Development currently assumes a Mac with ghc 8.10 & cabal 3.0. You can install them directly, or use ghcup. It should be possible to develop on other platforms and compilers, but I probably haven’t tried them myself.

cabal build --enable-tests # initial build
cabal repl # load the library and tests in ghci

Once the repl has loaded, you can run the tests with :main.

λ :main

Configuration exists for haskell-ide-engine, which can be integrated into many editors.

Advantages

interval-functor separates the representation of the coordinates of an interval from the representation of the space the coordinates occur in. This makes it particularly suitable for consistent treatment of multi-dimensional intervals; operations like e.g. union extend naturally to multi-dimensional spaces.

It is also thoroughly property tested and documented.