!ĄD;      !"#$%&'()*+,-./0123456789: Safe rangeThe Range Data structure; it is capable of representing any type of range. This is the primary data structure in this library. Everything should be possible to convert back into this datatype. All ranges in this structure are inclusively bound.range(Represents a single element as a range. SingletonRange a is equivalent to 1SpanRange (Bound a Inclusive) (Bound a Inclusive).rangevRepresents a bounded span of elements. The first argument is expected to be less than or equal to the second argument.rangeIRepresents a range with a finite lower bound and an infinite upper bound.rangeIRepresents a range with an infinite lower bound and a finite upper bound.range-Represents an infinite range over all values.range0Represents a bound at a particular value with a  ]. There is no implicit understanding if this is a lower or upper bound, it could be either. range$The value at the edge of this bound. rangeThe type of bound. Should be   or  . rangeRepresents a type of boundary. range:The value at the boundary should be included in the bound. range:The value at the boundary should be excluded in the bound. ;<=>Safe% rangeMathematically equivalent to [x, y].x +=+ y is the short version of 1SpanRange (Bound x Inclusive) (Bound y Inclusive)rangeMathematically equivalent to [x, y).x +=* y is the short version of 1SpanRange (Bound x Inclusive) (Bound y Exclusive)rangeMathematically equivalent to (x, y].x *=+ y is the short version of 1SpanRange (Bound x Exclusive) (Bound y Inclusive)rangeMathematically equivalent to (x, y).x *=* y is the short version of 1SpanRange (Bound x Exclusive) (Bound y Exclusive)rangeMathematically equivalent to  [x, Infinity).lbi x is the short version of #LowerBoundRange (Bound x Inclusive)rangeMathematically equivalent to  (x, Infinity).lbe x is the short version of #LowerBoundRange (Bound x Exclusive)rangeMathematically equivalent to  (Infinity, x].ubi x is the short version of #UpperBoundRange (Bound x Inclusive)rangeMathematically equivalent to  (Infinity, x).ube x is the short version of #UpperBoundRange (Bound x Exclusive)rangeShorthand for the  Safe%?@ABCDEFGHIJKLMNOPQRSTUVWXSafe&{YZ[\]^Safe&_`abcdefghijklmnopqrstuv Safe4>+CrangeThis is an F-Algebra. You don't need to know what this is in order to be able to use this module, but, if you are interested you can  Chttps://www.schoolofhaskell.com/user/bartosz/understanding-algebrasread more on School of Haskell. wxyz{|}~ Safe+ Safe+Safe=?@A;. rangeRepresents the fact that there exists an algebra for the given representation of a range, so that a range expression of the same type can be evaluated, yielding that representation.rangeDThis function is used to convert your built expressions into ranges.range7Lifts the input value as a constant into an expression.rangeJReturns an expression that represents the inverse of the input expression.rangeMReturns an expression that represents the set union of the input expressions.rangeTReturns an expression that represents the set intersection of the input expressions.rangeRReturns an expression that represents the set difference of the input expressions. rangelMultiple ranges represented by a predicate function, indicating membership of a point in one of the ranges.!rangeMultiple ranges represented by a list of disjoint ranges. Note that input ranges are allowed to overlap, but the output ranges are guaranteed to be disjoint.  Safe"range[Performs a set union between the two input ranges and returns the resultant set of ranges. For example:4union [SpanRange 1 10] [SpanRange 5 (15 :: Integer)][SpanRange 1 15](0.00 secs, 587,152 bytes)#rangebPerforms a set intersection between the two input ranges and returns the resultant set of ranges. For example:;intersection [SpanRange 1 10] [SpanRange 5 (15 :: Integer)][SpanRange 5 10](0.00 secs, 584,616 bytes)$range`Performs a set difference between the two input ranges and returns the resultant set of ranges. For example:9difference [SpanRange 1 10] [SpanRange 5 (15 :: Integer)][SpanRange 1 4](0.00 secs, 590,424 bytes)%rangeRAn inversion function, given a set of ranges it returns the inverse set of ranges. For example:5invert [SpanRange 1 10, SpanRange 15 (20 :: Integer)]6[LowerBoundRange 21,UpperBoundRange 0,SpanRange 11 14](0.00 secs, 623,456 bytes)&rangeA check to see if two ranges overlap. The ranges overlap if at least one value exists within both ranges. If they do overlap then true is returned; false otherwise. For example:!rangesOverlap (1 +=+ 5) (3 +=+ 7)True!rangesOverlap (1 +=+ 5) (5 +=+ 7)True!rangesOverlap (1 +=* 5) (5 +=+ 7)FalseJThe last case of these three is the primary "gotcha" of this method. With [1, 5) and [5, 7] there is no value that exists within both ranges. Therefore, technically, the ranges do not overlap. If you expected this to return True then it is likely that you would prefer to use ' instead.'rangeA check to see if two ranges overlap or adjoin. The ranges adjoin if no values exist between them. If they do overlap or adjoin then true is returned; false otherwise. For example: rangesAdjoin (1 +=+ 5) (3 +=+ 7)True rangesAdjoin (1 +=+ 5) (5 +=+ 7)True rangesAdjoin (1 +=* 5) (5 +=+ 7)TrueJThe last case of these three is the primary "gotcha" of this method. With [1, 5) and [5, 7] there exist no values between them. Therefore the ranges adjoin. If you expected this to return False then it is likely that you would prefer to use & instead.(range|Given a range and a value it will tell you wether or not the value is in the range. Remember that all ranges are inclusive.The primary value of this library is performance and this method can be used to show this quite clearly. For example, you can try and approximate basic range functionality with "Data.List.elem" so we can generate an apples to apples comparison in GHCi::set +s(elem (10000000 :: Integer) [1..10000000]True(0.26 secs, 720,556,888 bytes).inRange (1 +=+ 10000000) (10000000 :: Integer)True(0.00 secs, 557,656 bytes)xAs you can see, this function is significantly more performant, in both speed and memory, than using the elem function.)rangeGiven a list of ranges this function tells you if a value is in any of those ranges. This is especially useful for more complex ranges.*range^Checks if the value provided is above (or greater than) the biggest value in the given range.The LowerBoundRange and the  InfiniteRange will always cause this method to return False because you can't have a value higher than them since they are both infinite in the positive direction.,aboveRange (SingletonRange 5) (6 :: Integer)True#aboveRange (1 +=+ 5) (6 :: Integer)True#aboveRange (1 +=+ 5) (0 :: Integer)False!aboveRange (lbi 0) (6 :: Integer)False!aboveRange (ubi 0) (6 :: Integer)TrueaboveRange inf (6 :: Integer)False+rangeAChecks if the value provided is above all of the ranges provided.,range\Checks if the value provided is below (or less than) the smallest value in the given range.The UpperBoundRange and the  InfiniteRange will always cause this method to return False because you can't have a value lower than them since they are both infinite in the negative direction.,belowRange (SingletonRange 5) (4 :: Integer)True#belowRange (1 +=+ 5) (0 :: Integer)True#belowRange (1 +=+ 5) (6 :: Integer)False!belowRange (lbi 6) (0 :: Integer)True!belowRange (ubi 6) (0 :: Integer)FalsebelowRange inf (6 :: Integer)False-rangeAChecks if the value provided is below all of the ranges provided..rangezAn array of ranges may have overlaps; this function will collapse that array into as few Ranges as possible. For example:5mergeRanges [lbi 12, 1 +=+ 10, 5 +=+ (15 :: Integer)][lbi 1](0.01 secs, 588,968 bytes)~As you can see, the mergeRanges method collapsed multiple ranges into a single range that still covers the same surface area.'This may be useful for a few use cases:You are hyper concerned about performance and want to have the minimum number of ranges for comparison in the inRanges function.You wish to display ranges to a human and want to show the minimum number of ranges to avoid having to make people perform those calculations themselves.Please note that the use of any of the operations on sets of ranges like invert, union and intersection will have the same behaviour as mergeRanges as a side effect. So, for example, this is redundant: mergeRanges . union [] /range)Instantiate all of the values in a range.WarningD: This method is meant as a convenience method, it is not efficient.A set of ranges represents a collection of real values without actually instantiating those values. Not instantiating ranges, allows the range library to support infinite ranges and be super performant.However, sometimes you actually want to get the values that your range represents, or even get a sample set of the values. This function generates as many of the values that belong to your range as you like.Because ranges can be infinite, it is highly recommended to combine this method with something like "Data.List.take" to avoid an infinite recursion.This method will attempt to take a sample from all of the ranges that you have provided, however it is not guaranteed that you will get an even sampling. All that is guaranteed is that you will only get back values that are within one or more of the ranges you provide.ExamplesA simple span:<take 5 . fromRanges $ [1 +=+ 10 :: Range Integer, 20 +=+ 30] [1,20,2,21,3](0.01 secs, 566,016 bytes)An infinite range:,take 5 . fromRanges $ [inf :: Range Integer] [0,1,-1,2,-2](0.00 secs, 566,752 bytes)0rangeEJoins together ranges that we only know can be joined because of the  class.[To make the purpose of this method easier to understand, let's run throuh a simple example:2mergeRanges [1 +=+ 5, 6 +=+ 10] :: [Range Integer][1 +=+ 5,6 +=+ 10]>In this example, you know that the values are all of the type _. Because of this, you know that there are no values between 5 and 6. You may expect that the . function should "just know" that it can merge these together; but it can't because it does not have the required constraints. This becomes more obvious if you modify the example to use  instead:9mergeRanges [1.5 +=+ 5.5, 6.5 +=+ 10.5] :: [Range Double][1.5 +=+ 5.5,6.5 +=+ 10.5]Now we can see that there are an infinite number of values between 5.5 and 6.5 and thus no such join between the two ranges could occur.LThis function, joinRanges, provides the missing piece that you would expect:?joinRanges $ mergeRanges [1 +=+ 5, 6 +=+ 10] :: [Range Integer] [1 +=+ 10]PYou can use this method to ensure that all ranges for whom the value implements 5 can be compressed to their smallest representation.% "#$%&'()*+,-./0%()*+,-&'."#$%/0 Safe>1rangeKThese are the arguments that will be used when parsing a string as a range.3range$A separator that represents a union.4range5A separator that separates the two halves of a range.5range,A separator that implies an unbounded range.6rangeThese are the default arguments that are used by the parser. Please feel free to use the default arguments for you own parser and modify it from the defaults at will.7rangeGiven a string, this function will either return a parse error back to the user or the list of ranges that are represented by the parsed string. Very useful for CLI programs that need to load ranges from a single-line string.8rangeIf you disagree with the default characters for separating ranges then this function can be used to customise them, up to a point.9rangeeGiven the parser arguments this returns a parsec parser that is capable of parsing a list of ranges. 123456789 781234569  !"# $ %&'()*+,-.*+,)/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ %      $range-0.3.0.0-GAtYcP9NVcmD7Ip1AILOOAData.Range.Parser Data.RangeData.Range.AlgebraData.Range.DataData.Range.OperatorsData.Range.UtilData.Range.SpansData.Range.RangeInternalData.Range.Algebra.InternalData.Range.Algebra.RangeData.Range.Algebra.Predicateparsec-3.1.13.0Text.Parsec.Error ParseErrorRangeSingletonRange SpanRangeLowerBoundRangeUpperBoundRange InfiniteRangeBound boundValue boundType BoundType Inclusive Exclusive+=++=**=+*=*lbilbeubiubeinfAlgebra RangeExpr RangeAlgebraevalconstinvertunion intersection difference$fRangeAlgebra->$fRangeAlgebra[] rangesOverlap rangesAdjoininRangeinRanges aboveRange aboveRanges belowRange belowRanges mergeRanges fromRanges joinRangesRangeParserArgsArgsunionSeparatorrangeSeparatorwildcardSymbol defaultArgs parseRangescustomParseRangesranges$fShowRangeParserArgs OverlapTypeAdjoinSeparateOverlap compareLower compareHighercompareLowerIntersectioncompareHigherIntersectioncompareUpperToLower minBounds maxBoundsminBoundsIntersectionmaxBoundsIntersection insertionSort invertBound isEmptySpanremoveEmptySpansboundsOverlapType orOverlapType pointJoinTypeboundCmpboundIsBetweensingletonInSpanagainstLowerBoundagainstUpperBound takeEvenlysafeHeadpairslowestValueInLowerBoundhighestValueInUpperBoundinsertionSortSpansspanCmpintersectSpans joinSpans unionSpans invertSpans RangeMergeIRMRM spanRangeslargestUpperBoundlargestLowerBoundemptyRangeMerge storeRange storeRanges loadRangesexportRangeMergeintersectSpansRM intersectWithfixLowerfixUpperintersectionRangeMergescalculateBoundOverlapunionRangeMergesfilterLowerBoundfilterUpperBoundinvertRMjoinRM updateBound unmergeRMgetFree RangeExprF Difference IntersectionInvertUnionrangeMergeAlgebra rangeAlgebrapredicateAlgebrabaseGHC.EnumEnum integer-gmpGHC.Integer.TypeIntegerghc-prim GHC.TypesDouble