!4      !"#$%&'()*+,-./0123 SafeOrange'A Range Tree is a construct that can be built and then efficiently evaluated so that you can compress an entire tree of operations on ranges into a single range quickly. The only purpose of this tree is to allow efficient construction of range operations that can be evaluated as is required.range8Combine two range trees together with a single operationrangeInvert a range tree, this is a 4 operation.range8A leaf with a set of ranges that are collected together.rangeMThese are the operations that can join two disjunct lists of ranges together.range#Represents the set union operation.range*Represents the set intersection operation.range(Represents the set difference operation. 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. range5Represents a bounded and inclusive range of elements. range6Represents a range with only an inclusive lower bound. range6Represents a range with only an inclusive upper bound.range-Represents an infinite range over all values.  Safe56789Safe :;<=>?@AB SafedCDEFGHIJKLMNOPQRSTUVWXY Safe3<rangeThis 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. Z[\]^_`a Safe8b SafescSafe;=>?+ 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.rangeEvaluates a Range Tree into the final set of ranges that it compresses down to. Use this whenever you want to finally evaluate your constructed Range Tree.  Safej range[Performs a set union between the two input ranges and returns the resultant set of ranges. For example: mghci> union [SpanRange 1 10] [SpanRange 5 (15 :: Integer)] [SpanRange 1 15] (0.00 secs, 587,152 bytes) ghci> rangebPerforms a set intersection between the two input ranges and returns the resultant set of ranges. For example: tghci> intersection [SpanRange 1 10] [SpanRange 5 (15 :: Integer)] [SpanRange 5 10] (0.00 secs, 584,616 bytes) ghci> range`Performs a set difference between the two input ranges and returns the resultant set of ranges. For example: qghci> difference [SpanRange 1 10] [SpanRange 5 (15 :: Integer)] [SpanRange 1 4] (0.00 secs, 590,424 bytes) ghci> rangeRAn inversion function, given a set of ranges it returns the inverse set of ranges. For example: ghci> invert [SpanRange 1 10, SpanRange 15 (20 :: Integer)] [LowerBoundRange 21,UpperBoundRange 0,SpanRange 11 14] (0.00 secs, 623,456 bytes) ghci> rangeYA check to see if two ranges overlap. If they do then true is returned; false otherwise. 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: ghci> :set +s ghci> elem (10000000 :: Integer) [1..10000000] True (0.26 secs, 720,556,888 bytes) ghci> inRange (SpanRange 1 10000000) (10000000 :: Integer) True (0.00 secs, 557,656 bytes) ghci> 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."rangezAn array of ranges may have overlaps; this function will collapse that array into as few Ranges as possible. For example: ghci> mergeRanges [LowerBoundRange 12, SpanRange 1 10, SpanRange 5 (15 :: Integer)] [LowerBoundRange 1] (0.01 secs, 588,968 bytes) ghci> ~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 . intersection [] #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.ExamplesA simple span: kghci> take 5 . fromRanges $ [SpanRange 1 10 :: Range Integer] [1,2,3,4,5] (0.01 secs, 566,016 bytes) ghci> An infinite range: lghci> take 5 . fromRanges $ [InfiniteRange :: Range Integer] [0,1,-1,2,-2] (0.00 secs, 566,752 bytes) ghci>   !"#  !"#Safe<yG$rangeKThese are the arguments that will be used when parsing a string as a range.&range$A separator that represents a union.'range5A separator that separates the two halves of a range.(range,A separator that implies an unbounded range.)rangeThese 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.*rangeGiven 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.+rangeIf you disagree with the default characters for separating ranges then this function can be used to customise them, up to a point.,rangeeGiven the parser arguments this returns a parsec parser that is capable of parsing a list of ranges. $%&'()*+, *+$%&'(),Safe.rangexThe Nested Range is a structure that in a nested form of many ranges where there can be multiple ranges at every level.XFor example, saying that you require a minimum version of 1.2.3 could be represented as: JNestedRange [[LowerBoundRange 1],[LowerBoundRange 2],[LowerBoundRange 3]] 0rangeqGiven a list of nested values and a nested range tell us wether the nested value exists inside the nested range.ExamplesIn a simple case: {ghci> inNestedRange [2, 8, 3] (NestedRange [[SpanRange 1 2]] :: NestedRange Integer) True (0.01 secs, 558,400 bytes) ghci> Not in the bounds: ghci> inNestedRange [2, 8, 3] (NestedRange [[SpanRange 1 2], [UpperBoundRange 7]] :: NestedRange Integer) False (0.00 secs, 558,896 bytes) ghci> $For something based on Data.Version:  ghci> version = Version [2, 8, 3] [] ghci> upperBound = Version [2, 7] [] ghci> inNestedRange (versionBranch version) (fromVersion UpperBoundRange upperBound) False ghci> ghci> inNestedRange (versionBranch version) (fromVersion LowerBoundRange upperBound) True ghci> 1rangeThis method converts the  Data.Version datatype into a  NestedRange. For example: ghci> fromVersion LowerBoundRange (Version [1, 2, 3] []) NestedRange [[LowerBoundRange 1],[LowerBoundRange 2],[LowerBoundRange 3]] (0.01 secs, 624,736 bytes) ghci> ./01./10d    !"#$%&'()$%&#*+,-./01234567899:;<=>?@ABCDEFGHIJKLMN O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e  f g h i j k l m no#range-0.2.1.0-l0iABFqbq2LIpLgpbYLS6Data.Range.ParserData.Range.RangeTreeData.Range.RangeData.Range.AlgebraData.Range.NestedRangeData.Range.DataData.Range.UtilData.Range.SpansData.Range.RangeInternalData.Range.Algebra.InternalData.Range.Algebra.RangeData.Range.Algebra.Predicateparsec-3.1.13.0Text.Parsec.Error ParseError RangeTree RangeNodeRangeNodeInvert RangeLeafRangeOperation RangeUnionRangeIntersectionRangeDifferenceRangeSingletonRange SpanRangeLowerBoundRangeUpperBoundRange InfiniteRangeAlgebra RangeExpr RangeAlgebraevalconstinvertunion intersection difference$fRangeAlgebra(->)$fRangeAlgebra[]evaluate rangesOverlapinRangeinRanges mergeRanges fromRangesRangeParserArgsArgsunionSeparatorrangeSeparatorwildcardSymbol defaultArgs parseRangescustomParseRangesranges$fShowRangeParserArgs NestedRange inNestedRange fromVersion$fEqNestedRange$fShowNestedRangeghc-prim GHC.Classesnot insertionSort isBetween takeEvenlysafeHeadpairsinsertionSortSpansspanCmpintersectSpans insertSpan sortSpans joinSpans unionSpans invertSpans hasOverlaps RangeMergeIRMRM spanRangeslargestUpperBoundlargestLowerBoundemptyRangeMerge storeRange storeRanges loadRangesexportRangeMergeintersectSpansRM intersectWithfixLowerfixUpperintersectionRangeMergescalculateBoundOverlapunionRangeMergesfilterLowerBoundfilterUpperBoundboundCmp appendSpanRMinvertRMgetFree RangeExprF Difference IntersectionInvertUnionrangeMergeAlgebra rangeAlgebrapredicateAlgebra