numhask-prelude 0.0.4.1 → 0.0.5.1
raw patch · 4 files changed
+20/−27 lines, 4 filesdep ~numhaskPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: numhask
API changes (from Hackage documentation)
+ NumHask.Prelude: fail :: Monad m => forall a. () => String -> m a
- NumHask.Laws: lowerBoundedFieldLaws :: forall a. (Eq a, UpperBoundedField a, LowerBoundedField a) => [Law a]
+ NumHask.Laws: lowerBoundedFieldLaws :: forall a. (Eq a, LowerBoundedField a) => [Law a]
- NumHask.Laws: quotientFieldLaws :: (Field a, QuotientField a, FromInteger a) => [Law a]
+ NumHask.Laws: quotientFieldLaws :: (Field a, QuotientField a Integer, FromInteger a) => [Law2 a Integer]
Files
- numhask-prelude.cabal +2/−2
- src/NumHask/Laws.hs +9/−18
- src/NumHask/Prelude.hs +7/−5
- test/test.hs +2/−2
numhask-prelude.cabal view
@@ -1,5 +1,5 @@ name: numhask-prelude-version: 0.0.4.1+version: 0.0.5.1 synopsis: A numeric prelude description: A numeric prelude, combining protolude and numhask. category: mathematics@@ -33,7 +33,7 @@ build-depends: QuickCheck >=2.8 && <3 , base >=4.7 && <4.12- , numhask >=0.2 && <0.3+ , numhask >=0.2.2.0 && <0.3 , protolude >=0.1 && <0.3 , tasty >= 1.0.1.1 && <1.2 , tasty-quickcheck >= 0.9.2 && <1.0
src/NumHask/Laws.hs view
@@ -361,39 +361,30 @@ (\a -> ((one ::a) / zero + infinity == infinity) && (infinity + a == infinity) &&- isNaN ((infinity :: a) / infinity) &&- isNaN (nan + a) && (zero :: a) / zero /= nan)) ] -lowerBoundedFieldLaws :: forall a. (Eq a, UpperBoundedField a, LowerBoundedField a) => [Law a]+lowerBoundedFieldLaws :: forall a. (Eq a, LowerBoundedField a) => [Law a] lowerBoundedFieldLaws = [ ( "lower bounded field (negative infinity) laws" , Unary (\a -> (negate (one ::a) / zero == negInfinity) && ((negInfinity :: a) + negInfinity == negInfinity) &&- (negInfinity + a == negInfinity) &&- isNaN ((infinity :: a) - infinity) &&- isNaN ((negInfinity :: a) - negInfinity) &&- isNaN ((negInfinity :: a) / negInfinity) &&- isNaN (nan + a) && (zero :: a) / zero /= nan))+ (negInfinity + a == negInfinity))) ] ----quotientFieldLaws :: (Field a, QuotientField a, FromInteger a) => [Law a]+quotientFieldLaws :: (Field a, QuotientField a Integer, FromInteger a) => [Law2 a Integer] quotientFieldLaws = [ ( "a - one < floor a <= a <= ceiling a < a + one"- , Unary+ , Unary10 (\a ->- ((a - one) < fromIntegral (floor a)) &&- (fromIntegral (floor a) <= a) &&- (a <= fromIntegral (ceiling a)) &&- (fromIntegral (ceiling a) < a + one)))+ ((a - one) < (fromInteger (floor a))) &&+ (fromInteger (floor a) <= a) &&+ (a <= fromInteger (ceiling a)) &&+ (fromInteger (ceiling a) < a + one))) , ( "round a == floor (a + one/(one+one))"- , Unary (\a -> round a == floor (a + one / (one + one))))+ , Unary10 (\a -> (round a :: Integer) == ((floor (a + one / (one + one)))))) ] expFieldLaws :: forall a b.
src/NumHask/Prelude.hs view
@@ -10,8 +10,9 @@ , (<>) , Semigroup #endif- -- RebindableSyntax takes fromString away so we need to put it back in+ -- RebindableSyntax takes fromString and fail away so we need to put it back in , fromString+ , fail , Complex(..) , Natural(..) -- * Algebraic Heirarchy@@ -36,20 +37,21 @@ hiding (Integral(..), Rep, Semiring(..), (*), (**), (+), (-), (/), (^), (^^), abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceiling, cos, cosh, exp, floor, fromInteger,- fromIntegral, even, odd, infinity, isNaN, log, logBase, negate, pi, product,+ fromIntegral, even, odd, infinity, log, logBase, negate, pi, product, properFraction, recip, round, sin, sinh, sqrt, sum, tan, tanh, toInteger, trans,- zero, fromRational, Ratio(..), Rational, reduce, gcd)+ zero, fromRational, Ratio(..), Rational, reduce, gcd, subtract) #else import Protolude hiding (Integral(..), Rep, Semiring(..), (*), (**), (+), (-), (/), (^), (^^), abs, acos, acosh, asin, asinh, atan, atan2, atanh, ceiling, cos, cosh, exp, floor, fromInteger,- fromIntegral, even, odd, infinity, isNaN, log, logBase, negate, pi, product,+ fromIntegral, even, odd, infinity, log, logBase, negate, pi, product, properFraction, recip, round, sin, sinh, sqrt, sum, tan, tanh, toInteger, trans,- zero, fromRational, Ratio(..), Rational, reduce, gcd, (<>), Semigroup)+ zero, fromRational, Ratio(..), Rational, reduce, gcd, subtract, (<>), Semigroup) import Data.Semigroup ((<>), Semigroup) #endif +import Control.Monad (fail) import Data.String import GHC.Natural(Natural(..))
test/test.hs view
@@ -237,7 +237,7 @@ , testGroup "Lower Bounded Field" $ testLawOf ([] :: [Float]) <$> lowerBoundedFieldLaws , testGroup "Quotient Field" $- testLawOf ([] :: [Float]) <$> quotientFieldLaws+ testLawOf2 ([] :: [(Float,Integer)]) <$> quotientFieldLaws , testGroup "Exponential Field" $ testLawOf2 ([] :: [(Float,Float)]) <$> expFieldLaws , testGroup "Rational" $ testLawOf ([] :: [Float]) <$> rationalLaws ]@@ -264,7 +264,7 @@ , testGroup "Lower Bounded Field" $ testLawOf ([] :: [Double]) <$> lowerBoundedFieldLaws , testGroup "Quotient Field" $- testLawOf ([] :: [Double]) <$> quotientFieldLaws+ testLawOf2 ([] :: [(Double,Integer)]) <$> quotientFieldLaws , testGroup "Exponential Field" $ testLawOf2 ([] :: [(Double,Double)]) <$> expFieldLaws , testGroup "Rational" $ testLawOf ([] :: [Double]) <$> rationalLaws ]