Interval datatype, interval arithmetic and interval-based containers

Version on this page:2.1.0
LTS Haskell 21.22:2.1.1@rev:2
Stackage Nightly 2023-12-03:2.1.1@rev:2
Latest on Hackage:2.1.1@rev:2

See all snapshots data-interval appears in

BSD-3-Clause licensed by Masahiro Sakai (
This version can be pinned in stack with:data-interval-2.1.0@sha256:758b3ec2c66c4fde92f0e3f831cb067718d006073d1a43638b081fdaa878f250,2687


Build Status (Travis-CI) Build Status (GitHub Actions) Hackage Hackage Deps Coverage Status License

Interval datatype, interval arithmetic, and interval-based containers for Haskell.

Unlike the intervals package, this package provides both open and closed intervals and is intended to be used with Rational.



  • introduce operations for Allen’s interval algebra (#18, thanks to marcosh)
  • make recip precise when 0 is not an interior point (#21)
  • add instance Storable for Interval (#25)
  • add instance Floating for Interval (#26)


  • change internal representation of Interval and IntegerInterval to reduce memory footprint (#7, thanks Bodigrim)
  • introduce Boundary type (#10, thanks Bodigrim)
  • export isSingleton function for Interval and IntegerInterval (#13)
  • remove deprecated EndPoint data type (#14, thanks Bodigrim)


  • support lattices-2.0 (Thanks to Bodigrim).
  • move definitions of Interval and IntegerInterval data types into internal modules and abstract away representations from the rest of modules (Thanks to Bodigrim).


  • add Data.IntervalSet, Data.IntervalMap.Lazy, Data.IntervalMap.Strict modules
  • add new function mapMonotonic to Data.Interval and Data.IntegerInterval
  • add new function isConnected to Data.Interval.


  • add Data.IntegerInterval
  • use extended-reals >=0.2
  • EndPoint is deprecated. Use Extended instead.


  • remove unnecessary Real constraint from comparison operators.


  • remove unnecessary Num constraint from bunch of constructors and operations: interval, (<=..<=), (<..<=), (<=..<), (<..<), whole, empty, singleton, intersection, intersections, hull, hulls. Thanks to Tad Doxsee for pointing out that.


  • use extended-reals package for representing endpoints
  • add (experimental) comparison operators that produce witnesses: (<??), (<=??), (==??), (>=??), (>??)


  • add hulls, intersections :: (Num r, Ord r) => [Interval r] -> Interval r
  • fix a bug of (<=?) operator


  • fix dependency issue with QuickCheck and test-framework-quickcheck2


  • add simplestRationalWithin :: RealFrac r => Interval r -> Maybe Rational