range-0.3.0.2: An efficient and versatile range library.

Data.Ranges

Description

This module provides a simpler interface than the Range module, allowing you to work with multiple ranges at the same time.

One of the main advantages of this module is that it implements Monoid for Ranges which lets you write code like:

Synopsis

# Range creation

(+=+) :: a -> a -> Ranges a Source #

(+=*) :: a -> a -> Ranges a Source #

(*=+) :: a -> a -> Ranges a Source #

(*=*) :: a -> a -> Ranges a Source #

lbi :: a -> Ranges a Source #

lbe :: a -> Ranges a Source #

ubi :: a -> Ranges a Source #

ube :: a -> Ranges a Source #

# Comparison functions

inRanges :: Ord a => Ranges a -> a -> Bool Source #

aboveRanges :: Ord a => Ranges a -> a -> Bool Source #

Checks if the value provided is above all of the ranges provided.

belowRanges :: Ord a => Ranges a -> a -> Bool Source #

Checks if the value provided is below all of the ranges provided.

# Set operations

union :: Ord a => Ranges a -> Ranges a -> Ranges a Source #

difference :: Ord a => Ranges a -> Ranges a -> Ranges a Source #

invert :: Ord a => Ranges a -> Ranges a Source #

# Enumerable methods

fromRanges :: (Ord a, Enum a) => Ranges a -> [a] Source #

joinRanges :: (Ord a, Enum a) => Ranges a -> Ranges a Source #

# Data types

newtype Ranges a Source #

Constructors

 Ranges FieldsunRanges :: [Range a]
Instances
 Source # Instance detailsDefined in Data.Ranges Methodsfmap :: (a -> b) -> Ranges a -> Ranges b #(<\$) :: a -> Ranges b -> Ranges a # Show a => Show (Ranges a) Source # Instance detailsDefined in Data.Ranges MethodsshowsPrec :: Int -> Ranges a -> ShowS #show :: Ranges a -> String #showList :: [Ranges a] -> ShowS # Ord a => Semigroup (Ranges a) Source # Instance detailsDefined in Data.Ranges Methods(<>) :: Ranges a -> Ranges a -> Ranges a #sconcat :: NonEmpty (Ranges a) -> Ranges a #stimes :: Integral b => b -> Ranges a -> Ranges a # Ord a => Monoid (Ranges a) Source # Instance detailsDefined in Data.Ranges Methodsmappend :: Ranges a -> Ranges a -> Ranges a #mconcat :: [Ranges a] -> Ranges a #