data-interval-2.1.1: Interval datatype, interval arithmetic and interval-based containers
Copyright (c) Masahiro Sakai 2016
License BSD-style
Maintainer masahiro.sakai@gmail.com
Stability provisional
Portability non-portable (CPP, ScopedTypeVariables, TypeFamilies, DeriveDataTypeable, MultiWayIf)
Safe Haskell Trustworthy
Language Haskell2010

Data.IntervalSet

Description

Interval datatype and interval arithmetic.

Synopsis

IntervalSet type

data IntervalSet r Source #

A set comprising zero or more non-empty, disconnected intervals.

Any connected intervals are merged together, and empty intervals are ignored.

Instances

Instances details
Ord r => IsList ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Associated Types

type Item ( IntervalSet r) Source #

Eq r => Eq ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

( Real r, Fractional r) => Fractional ( IntervalSet r) Source #
recip (recip xs) == delete 0 xs
Instance details

Defined in Data.IntervalSet

( Ord r, Data r) => Data ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> IntervalSet r -> c ( IntervalSet r) Source #

gunfold :: ( forall b r0. Data b => c (b -> r0) -> c r0) -> ( forall r1. r1 -> c r1) -> Constr -> c ( IntervalSet r) Source #

toConstr :: IntervalSet r -> Constr Source #

dataTypeOf :: IntervalSet r -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( IntervalSet r)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( IntervalSet r)) Source #

gmapT :: ( forall b. Data b => b -> b) -> IntervalSet r -> IntervalSet r Source #

gmapQl :: (r0 -> r' -> r0) -> r0 -> ( forall d. Data d => d -> r') -> IntervalSet r -> r0 Source #

gmapQr :: forall r0 r'. (r' -> r0 -> r0) -> r0 -> ( forall d. Data d => d -> r') -> IntervalSet r -> r0 Source #

gmapQ :: ( forall d. Data d => d -> u) -> IntervalSet r -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> IntervalSet r -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> IntervalSet r -> m ( IntervalSet r) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> IntervalSet r -> m ( IntervalSet r) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> IntervalSet r -> m ( IntervalSet r) Source #

( Num r, Ord r) => Num ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

( Ord r, Read r) => Read ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

( Ord r, Show r) => Show ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Ord r => Semigroup ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Ord r => Monoid ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

NFData r => NFData ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Hashable r => Hashable ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Ord r => Lattice ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Ord r => BoundedJoinSemiLattice ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Ord r => BoundedMeetSemiLattice ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

type Item ( IntervalSet r) Source #
Instance details

Defined in Data.IntervalSet

Construction

whole :: Ord r => IntervalSet r Source #

whole real number line (-∞, ∞)

empty :: Ord r => IntervalSet r Source #

empty interval set

Query

null :: IntervalSet r -> Bool Source #

Is the interval set empty?

member :: Ord r => r -> IntervalSet r -> Bool Source #

Is the element in the interval set?

notMember :: Ord r => r -> IntervalSet r -> Bool Source #

Is the element not in the interval set?

isSubsetOf :: Ord r => IntervalSet r -> IntervalSet r -> Bool Source #

Is this a subset? (is1 ` isSubsetOf ` is2) tells whether is1 is a subset of is2 .

isProperSubsetOf :: Ord r => IntervalSet r -> IntervalSet r -> Bool Source #

Is this a proper subset? ( i.e. a subset but not equal).

span :: Ord r => IntervalSet r -> Interval r Source #

convex hull of a set of intervals.

Construction

complement :: Ord r => IntervalSet r -> IntervalSet r Source #

Complement the interval set.

insert :: Ord r => Interval r -> IntervalSet r -> IntervalSet r Source #

Insert a new interval into the interval set.

delete :: Ord r => Interval r -> IntervalSet r -> IntervalSet r Source #

Delete an interval from the interval set.

Combine

unions :: Ord r => [ IntervalSet r] -> IntervalSet r Source #

union of a list of interval sets

intersection :: Ord r => IntervalSet r -> IntervalSet r -> IntervalSet r Source #

intersection of two interval sets

intersections :: Ord r => [ IntervalSet r] -> IntervalSet r Source #

intersection of a list of interval sets

difference :: Ord r => IntervalSet r -> IntervalSet r -> IntervalSet r Source #

difference of two interval sets

Conversion

List

fromList :: Ord r => [ Interval r] -> IntervalSet r Source #

Build a interval set from a list of intervals.

toList :: Ord r => IntervalSet r -> [ Interval r] Source #

Convert a interval set into a list of intervals.

Ordered list

toAscList :: Ord r => IntervalSet r -> [ Interval r] Source #

Convert a interval set into a list of intervals in ascending order.

toDescList :: Ord r => IntervalSet r -> [ Interval r] Source #

Convert a interval set into a list of intervals in descending order.

fromAscList :: Ord r => [ Interval r] -> IntervalSet r Source #

Build a map from an ascending list of intervals. The precondition is not checked.