packages feed

numbers 2009.8.9 → 3000.0.0.0

raw patch · 4 files changed

+84/−34 lines, 4 filesnew-uploaderPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Number.Dif: instance Floating a => Floating (Dif a)
- Data.Number.Dif: instance Fractional a => Fractional (Dif a)
- Data.Number.Dif: instance Num a => Num (Dif a)
- Data.Number.Symbolic: instance Floating a => Floating (Sym a)
- Data.Number.Symbolic: instance Fractional a => Fractional (Sym a)
- Data.Number.Symbolic: instance Num a => Num (Sym a)
- Data.Number.Symbolic: instance RealFloat a => RealFloat (Sym a)
+ Data.Number.Dif: instance (Floating a, Eq a) => Floating (Dif a)
+ Data.Number.Dif: instance (Fractional a, Eq a) => Fractional (Dif a)
+ Data.Number.Dif: instance (Num a, Eq a) => Num (Dif a)
+ Data.Number.Symbolic: instance (Floating a, Eq a) => Floating (Sym a)
+ Data.Number.Symbolic: instance (Fractional a, Eq a) => Fractional (Sym a)
+ Data.Number.Symbolic: instance (Num a, Eq a) => Num (Sym a)
+ Data.Number.Symbolic: instance (RealFloat a, Show a) => RealFloat (Sym a)
- Data.Number.Dif: dVar :: Num a => a -> Dif a
+ Data.Number.Dif: dVar :: (Num a, Eq a) => a -> Dif a
- Data.Number.Dif: deriv :: (Num a, Num b) => (Dif a -> Dif b) -> (a -> b)
+ Data.Number.Dif: deriv :: (Num a, Num b, Eq a, Eq b) => (Dif a -> Dif b) -> (a -> b)
- Data.Number.Dif: df :: Num a => Dif a -> Dif a
+ Data.Number.Dif: df :: (Num a, Eq a) => Dif a -> Dif a
- Data.Number.Dif: unDif :: Num a => (Dif a -> Dif b) -> (a -> b)
+ Data.Number.Dif: unDif :: (Num a, Eq a) => (Dif a -> Dif b) -> (a -> b)
- Data.Number.Symbolic: subst :: Num a => String -> Sym a -> Sym a -> Sym a
+ Data.Number.Symbolic: subst :: (Num a, Eq a) => String -> Sym a -> Sym a -> Sym a

Files

Data/Number/Dif.hs view
@@ -36,13 +36,13 @@ -- |The 'dVar' function turns a number into a variable -- number.  This is the number with with respect to which -- the derivaticve is computed.-dVar :: (Num a) => a -> Dif a+dVar :: (Num a, Eq a) => a -> Dif a dVar x = D x 1  -- |The 'df' takes a 'Dif' number and returns its first -- derivative.  The function can be iterated to to get -- higher derivaties.-df :: (Num a) => Dif a -> Dif a+df :: (Num a, Eq a) => Dif a -> Dif a df (D _ x') = x' df (C _   ) = 0 @@ -64,11 +64,11 @@ --  -- >  deriv f = val . df . f . dVar -- -deriv :: (Num a, Num b) => (Dif a -> Dif b) -> (a -> b)+deriv :: (Num a, Num b, Eq a, Eq b) => (Dif a -> Dif b) -> (a -> b) deriv f = val . df . f . dVar  -- |Convert a 'Dif' function to an ordinary function.-unDif :: (Num a) => (Dif a -> Dif b) -> (a -> b)+unDif :: (Num a, Eq a) => (Dif a -> Dif b) -> (a -> b) unDif f = val . f . dVar  instance (Show a) => Show (Dif a) where@@ -83,7 +83,7 @@ instance (Ord a) => Ord (Dif a) where     x `compare` y  =  val x `compare` val y -instance (Num a) => Num (Dif a) where+instance (Num a, Eq a) => Num (Dif a) where     (C x)    + (C y)         =  C (x + y)     (C x)    + (D y y')      =  D (x + y) y'     (D x x') + (C y)         =  D (x + y) x'@@ -115,18 +115,18 @@     signum (C x)             =  C (signum x)     signum (D x _)           =  C (signum x) -instance (Fractional a) => Fractional (Dif a) where+instance (Fractional a, Eq a) => Fractional (Dif a) where     recip (C x)    = C (recip x)     recip (D x x') = ip 	where ip = D (recip x) (-x' * ip * ip)     fromRational r = C (fromRational r) -lift :: (Num a) => [a -> a] -> Dif a -> Dif a+lift :: (Num a, Eq a) => [a -> a] -> Dif a -> Dif a lift (f : _) (C x) = C (f x) lift (f : f') p@(D x x') = D (f x) (x' * lift f' p) lift _ _ = error "lift" -instance (Floating a) => Floating (Dif a) where+instance (Floating a, Eq a) => Floating (Dif a) where     pi               = C pi      exp (C x)        = C (exp x)
Data/Number/Symbolic.hs view
@@ -33,7 +33,7 @@  -- | The expression @subst x v e@ substitutes the expression @v@ for each -- occurence of the variable @x@ in @e@.-subst :: (Num a) => String -> Sym a -> Sym a -> Sym a+subst :: (Num a, Eq a) => String -> Sym a -> Sym a -> Sym a subst _ _ e@(Con _) = e subst x v e@(App x' _ []) | x == x' = v       	                  | otherwise = e@@ -65,7 +65,7 @@     showsPrec p (App f _ xs) =         showParen (p>10) (foldl (.) (showString f) (map (\ x -> showChar ' ' . showsPrec 11 x) xs)) -instance (Num a) => Num (Sym a) where+instance (Num a, Eq a) => Num (Sym a) where     x + y         = binOp (+) x "+" y     x - y         = binOp (-) x "-" y     x * y         = binOp (*) x "*" y@@ -74,12 +74,12 @@     signum x      = unOp signum "signum" x     fromInteger x = Con (fromInteger x) -instance (Fractional a) => Fractional (Sym a) where+instance (Fractional a, Eq a) => Fractional (Sym a) where     x / y          = binOp (/) x "/" y     fromRational x = Con (fromRational x)  -- Assume the numbers are a field and simplify a little-binOp :: (Num a) => (a->a->a) -> Sym a -> String -> Sym a -> Sym a+binOp :: (Num a, Eq a) => (a->a->a) -> Sym a -> String -> Sym a -> Sym a binOp f (Con x) _ (Con y) = Con (f x y) binOp _ x "+" 0 = x binOp _ 0 "+" x = x@@ -141,7 +141,7 @@ instance (RealFrac a) => RealFrac (Sym a) where     properFraction (Con c) = (i, Con c') where (i, c') = properFraction c -instance (Floating a) => Floating (Sym a) where+instance (Floating a, Eq a) => Floating (Sym a) where     pi = var "pi"     exp = unOp exp "exp"     sqrt = unOp sqrt "sqrt"@@ -161,7 +161,7 @@     atanh = unOp atanh "atanh"     acosh = unOp acosh "acosh" -instance (RealFloat a) => RealFloat (Sym a) where+instance (RealFloat a, Show a) => RealFloat (Sym a) where     floatRadix = floatRadix . unSym     floatDigits = floatDigits . unSym     floatRange  = floatRange . unSym
+ LICENSE view
@@ -0,0 +1,33 @@+Copyright (c) 2007-2012+Lennart Augustsson, Russell O'Connor, Richard Smith,+Daniel Wagner, Dan Burton++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Dan Burton nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+
numbers.cabal view
@@ -1,20 +1,37 @@-Name:		numbers-Version:	2009.8.9-License:	BSD3-Author:		Lennart Augustsson-Maintainer:	Lennart Augustsson-Category:	Data, Math-Synopsis:	Various number types-Description:	Instances of the numerical classes for a variety of-		different numbers: (computable) real numbers,-		arbitrary precision fixed numbers,-		arbitrary precision floating point numbers,-		differentiable numbers, symbolic numbers,-		natural numbers, interval arithmetic.-Build-type:	Simple-Build-Depends:	base >= 3 && < 5-Exposed-modules:	Data.Number.Symbolic Data.Number.Dif-			Data.Number.CReal Data.Number.Fixed-			Data.Number.Interval Data.Number.BigFloat-			Data.Number.Natural-Other-modules:	Data.Number.Vectorspace Data.Number.FixedFunctions+Name:           numbers+Version:        3000.0.0.0+License:        BSD3+License-file:   LICENSE+Author:         Lennart Augustsson+Maintainer:     Lennart Augustsson+Category:       Data, Math+Synopsis:       Various number types+Description:+  Instances of the numerical classes for a variety of+  different numbers: (computable) real numbers,+  arbitrary precision fixed numbers,+  arbitrary precision floating point numbers,+  differentiable numbers, symbolic numbers,+  natural numbers, interval arithmetic.+Build-type:	    Simple++cabal-version:  >= 1.8++homepage:   https://github.com/DanBurton/numbers+source-repository head+  type:     git+  location: git://github.com/DanBurton/numbers.git+source-repository this+  type:     git+  location: git://github.com/DanBurton/numbers.git+  tag:      numbers-3000.0.0.0++Library+  Build-Depends:    base >= 3 && < 5+  Exposed-modules:+    Data.Number.Symbolic Data.Number.Dif+    Data.Number.CReal Data.Number.Fixed+    Data.Number.Interval Data.Number.BigFloat+    Data.Number.Natural+  Other-modules:    Data.Number.Vectorspace Data.Number.FixedFunctions+