!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred+(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeable Safe-Inferred+0HM.Create a directed interval.#Try to create a non-empty interval.The whole real number linewhole-Infinity ... Infinity An empty intervalempty NaN ... NaN negation handles NaN properlynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrue A singleton point singleton 11 ... 1 *The infinumum (lower bound) of an intervalinf (1 ... 20)1 )The supremum (upper bound) of an intervalsup (1 ... 20)20Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)False#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width emptyNaN Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5 "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5mignitude emptyNaN/Hausdorff distance between non-empty intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance empty (1 ... 1)NaN1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)2 ... 23Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 1.0 ... -1.0%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) 2.0 ... -2.0Construct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)2 ... -2#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect empty(NaN ... NaN,NaN ... NaN).Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint emptyNaN(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalse4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrue9lift a monotone increasing function over a given interval9lift a monotone decreasing function over a given interval,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0For all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)FalseFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)FalseFor all x in X, y in Y. x  y$Only singleton intervals return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)FalseFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)False For all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)False!For all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)False"For all x in X, y in Y. x op y#Check if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)False$Flipped version of #. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False%Does there exist an x in X, y in Y such that x  y?&Does there exist an x in X, y in Y such that x  y?'Does there exist an x in X, y in Y such that x  y?Does there exist an x in X, y in Y such that x  y?(Does there exist an x in X, y in Y such that x  y?)Does there exist an x in X, y in Y such that x  y?*Does there exist an x in X, y in Y such that x op y?+FThe nearest value to that supplied which is contained in the interval.,*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double-*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval FloatvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. will use the midpointE  !"#$%&'()*+,-*  !"#$%&'()*+,-*  #$"! *%&')(+,-D  !"#$%&'()*+,-(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeable Safe-Inferred+0HM,0;Create a non-empty interval, turning it around if necessary1#Try to create a non-empty interval.2The whole real number linewhole-Infinity ... Infinity3A singleton point singleton 11 ... 14*The infinumum (lower bound) of an intervalinf (1 ... 20)15)The supremum (upper bound) of an intervalsup (1 ... 20)206Is the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)False7#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)08 Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)59 "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5:#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0)<.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0=%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3>(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False?4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9lift a monotone increasing function over a given interval9lift a monotone decreasing function over a given interval@,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double)Just (5.0 ... 10.0)A*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0BFor all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)FalseCFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)FalseDFor all x in X, y in Y. x  y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)FalseFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)FalseEFor all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)FalseFFor all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)FalseGFor all x in X, y in Y. x op yHCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)FalseIFlipped version of H. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)FalseJDoes there exist an x in X, y in Y such that x  y?KDoes there exist an x in X, y in Y such that x  y?LDoes there exist an x in X, y in Y such that x  y?Does there exist an x in X, y in Y such that x  y?MDoes there exist an x in X, y in Y such that x  y?NDoes there exist an x in X, y in Y such that x  y?ODoes there exist an x in X, y in Y such that x op y?PFThe nearest value to that supplied which is contained in the interval.Q1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6RDeflate an interval by shrinking it from both ends. Note that in cases that would result in an empty interval, the result is a singleton interval at the midpoint.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0) 0.0 ... 0.0S%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0) -2.0 ... 2.0TConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2U*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval DoubleV*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval FloatvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. will use the midpoint>./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV)./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV)./0123>?4567<=@A:;89HIGBCDFEOJKLNMPQRSTUV=./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV0(c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeable Safe-Inferred+0HM(.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV(.0123>?4567<=@A:;89HIGBCDFEOJKLNMPQRSTUV(c) Edward Kmett 2010-2013BSD3ekmett@gmail.com experimentalDeriveDataTypeable Safe-Inferred+0HM+]The whole real number linewhole-Infinity ... Infinity^An empty intervalemptyEmpty_Check if an interval is emptynull (1 ... 5)Falsenull (1 ... 1)False null emptyTrue`A singleton point singleton 11 ... 1a(The infimum (lower bound) of an intervalinf (1.0 ... 20.0)1.0 inf empty*** Exception: empty intervalb)The supremum (upper bound) of an intervalsup (1.0 ... 20.0)20.0 sup empty*** Exception: empty intervalcIs the interval a singleton point? N.B. This is fairly fragile and likely will not hold after even a few operations that only involve singletonssingular (singleton 1)Truesingular (1.0 ... 20.0)Falsed#Calculate the width of an interval.width (1 ... 20)19width (singleton 1)0 width empty0e Magnitudemagnitude (1 ... 20)20magnitude (-20 ... 10)20magnitude (singleton 5)5throws  if the interval is empty.magnitude empty*** Exception: empty intervalf "mignitude"mignitude (1 ... 20)1mignitude (-20 ... 10)0mignitude (singleton 5)5throws  if the interval is empty.mignitude empty*** Exception: empty intervalg%Hausdorff distance between intervals.distance (1 ... 7) (6 ... 10)0distance (1 ... 7) (15 ... 24)8distance (1 ... 7) (-10 ... -2)3distance Empty (1 ... 1)*** Exception: empty intervalh1Inflate an interval by enlarging it at both ends.inflate 3 (-1 ... 7) -4 ... 10inflate (-2) (0 ... 4)-2 ... 6inflate 1 emptyEmptyi3Deflate an interval by shrinking it from both ends.deflate 3.0 (-4.0 ... 10.0) -1.0 ... 7.0deflate 2.0 (-1.0 ... 1.0)Emptydeflate 1.0 emptyEmptyj%Scale an interval about its midpoint.scale 1.1 (-6.0 ... 4.0) -6.5 ... 4.5scale (-2.0) (-1.0 ... 1.0)Emptyscale 3.0 emptyEmptykConstruct a symmetric interval. symmetric 3-3 ... 3symmetric (-2)-2 ... 2l#Bisect an interval at its midpoint.bisect (10.0 ... 20.0)(10.0 ... 15.0,15.0 ... 20.0)bisect (singleton 5.0)(5.0 ... 5.0,5.0 ... 5.0) bisect Empty (Empty,Empty)n.Nearest point to the midpoint of the interval.midpoint (10.0 ... 20.0)15.0midpoint (singleton 5.0)5.0midpoint empty*** Exception: empty intervalo(Determine if a point is in the interval.elem 3.2 (1.0 ... 5.0)Trueelem 5 (1.0 ... 5.0)Trueelem 1 (1.0 ... 5.0)Trueelem 8 (1.0 ... 5.0)False elem 5 emptyFalsep4Determine if a point is not included in the intervalnotElem 8 (1.0 ... 5.0)TruenotElem 1.4 (1.0 ... 5.0)False9And of course, nothing is a member of the empty interval.notElem 5 emptyTrue9lift a monotone increasing function over a given interval9lift a monotone decreasing function over a given intervalq,Calculate the intersection of two intervals.Hintersection (1 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 5.0 ... 10.0r*Calculate the convex hull of two intervals@hull (0 ... 10 :: Interval Double) (5 ... 15 :: Interval Double) 0.0 ... 15.0Ahull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) 0.0 ... 85.0sFor all x in X, y in Y. x  y?(5 ... 10 :: Interval Double) <! (20 ... 30 :: Interval Double)True?(5 ... 10 :: Interval Double) <! (10 ... 30 :: Interval Double)False?(20 ... 30 :: Interval Double) <! (5 ... 10 :: Interval Double)FalsetFor all x in X, y in Y. x  y@(5 ... 10 :: Interval Double) <=! (20 ... 30 :: Interval Double)True@(5 ... 10 :: Interval Double) <=! (10 ... 30 :: Interval Double)True@(20 ... 30 :: Interval Double) <=! (5 ... 10 :: Interval Double)FalseuFor all x in X, y in Y. x  y;Only singleton intervals or empty intervals can return trueE(singleton 5 :: Interval Double) ==! (singleton 5 :: Interval Double)True?(5 ... 10 :: Interval Double) ==! (5 ... 10 :: Interval Double)FalseFor all x in X, y in Y. x  y@(5 ... 15 :: Interval Double) /=! (20 ... 40 :: Interval Double)True@(5 ... 15 :: Interval Double) /=! (15 ... 40 :: Interval Double)FalsevFor all x in X, y in Y. x  y@(20 ... 40 :: Interval Double) >! (10 ... 19 :: Interval Double)True?(5 ... 20 :: Interval Double) >! (15 ... 40 :: Interval Double)FalsewFor all x in X, y in Y. x  yA(20 ... 40 :: Interval Double) >=! (10 ... 20 :: Interval Double)True@(5 ... 20 :: Interval Double) >=! (15 ... 40 :: Interval Double)FalsexFor all x in X, y in Y. x op yyCheck if interval X totally contains interval YH(20 ... 40 :: Interval Double) `contains` (25 ... 35 :: Interval Double)TrueH(20 ... 40 :: Interval Double) `contains` (15 ... 35 :: Interval Double)FalsezFlipped version of y. Check if interval X a subset of interval YJ(25 ... 35 :: Interval Double) `isSubsetOf` (20 ... 40 :: Interval Double)TrueJ(20 ... 40 :: Interval Double) `isSubsetOf` (15 ... 35 :: Interval Double)False{Does there exist an x in X, y in Y such that x  y?|Does there exist an x in X, y in Y such that x  y?}Does there exist an x in X, y in Y such that x  y?Does there exist an x in X, y in Y such that x  y?~Does there exist an x in X, y in Y such that x  y?Does there exist an x in X, y in Y such that x  y?Does there exist an x in X, y in Y such that x op y?*id function. Useful for type specification:t idouble (1 ... 3)$idouble (1 ... 3) :: Interval Double*id function. Useful for type specification:t ifloat (1 ... 3)"ifloat (1 ... 3) :: Interval FloatvWe have to play some semantic games to make these methods make sense. Most compute with the midpoint of the interval. will use the midpointAWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~,WXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~,WYX\Z[]^_`opabcdnqrlmefghijkyzxstuwv{|}~?WYXZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Z\(c) Edward Kmett 2010-2014BSD3ekmett@gmail.com experimentalDeriveDataTypeable Safe-Inferred*WZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~*W\Z[]^_`opabcdnqrlmefghijkyzxstuwv{|}~      !"#$%&'()*+,-./012     3 !"#$%&'()*+,-./012 4 5   3 !"#$%&'()*+,-./126789:;<=><=?<=@A<=B<=C<=DEFGHIJKLMNOPQRSTUVWXYZ[\]^_:;AEFGKLNOPQRSTUVWXY^:;AEFGKLNOPQRSTUVWXY^`intervals-0.7.1Numeric.Interval.ExceptionNumeric.Interval.KaucherNumeric.Interval.NonEmpty"Numeric.Interval.NonEmpty.InternalNumeric.IntervalNumeric.Interval.InternalAmbiguousComparison EmptyIntervalIntervalI...intervalwholeemptynull singletoninfsupsingularwidth magnitude mignitudedistanceinflatedeflatescale symmetricbisectmidpointelemnotElem intersectionhull!>=! certainlycontains isSubsetOf?>=?possiblyclampidoubleifloatbisectIntegralEmpty+/-$fExceptionAmbiguousComparison$fShowAmbiguousComparison$fExceptionEmptyInterval$fShowEmptyInterval increasing decreasingghc-prim GHC.Classes<<===/=!/=>>=/=?$fRealFloatInterval$fRealIntervalbaseGHC.Real realToFrac negInfinity posInfinitynanfmod divNonZero divPositive divNegativedivZero$fFloatingInterval$fRealFracInterval$fFractionalInterval $fOrdInterval $fNumInterval$fShowInterval $fEqInterval$fDistributiveInterval$fMonadInterval$fApplicativeInterval$fTraversableInterval$fFoldableInterval$fFunctorInterval