packages feed

non-negative 0.1 → 0.1.1

raw patch · 5 files changed

+31/−17 lines, 5 filesdep ~QuickCheckdep ~basedep ~utility-ht

Dependency ranges changed: QuickCheck, base, utility-ht

Files

Test/Numeric/NonNegative/Chunky.hs view
@@ -106,12 +106,12 @@    (\t -> t==t) . take 1000000 . show .    const (Chunky.fromChunks $ iterate (2-) (1::NonNegW.Integer)) -showInfinite1 :: (NonNeg.C a, Num a) => a -> Bool+showInfinite1 :: (NonNeg.C a, Num a, Show a) => a -> Bool showInfinite1 =    (\t -> t==t) . take 10000 . show .    (\n -> Chunky.fromChunks $ iterate (2-) (1+0*n)) -showInfinite2 :: (NonNeg.C a, Num a) => a -> Bool+showInfinite2 :: (NonNeg.C a, Num a, Show a) => a -> Bool showInfinite2 =    (\t -> t==t) . take 10000 . show . infinity 
non-negative.cabal view
@@ -1,5 +1,5 @@ Name:             non-negative-Version:          0.1+Version:          0.1.1 License:          GPL License-File:     LICENSE Author:           Henning Thielemann <haskell@henning-thielemann.de>@@ -12,27 +12,33 @@    a wrapper which can turn any ordered numeric type into a member of that class,    and a lazy number type for non-negative numbers    (a generalization of Peano numbers).-   This library is used by the 'event-list' package.-Tested-With:      GHC==6.4.1, GHC==6.8.2-Cabal-Version:    >=1.2+   This library is used by the @event-list@ package.+Tested-With:      GHC==6.4.1, GHC==6.8.2, GHC==7.8.3+Cabal-Version:    >=1.10 Build-Type:       Simple  Flag splitBase   description: Choose the new smaller, split-up base package. -Flag buildTests-  description: Build test executables-  default:     False+Source-Repository this+  Tag:         0.1.1+  Type:        darcs+  Location:    http://code.haskell.org/~thielema/non-negative/ +Source-Repository head+  Type:        darcs+  Location:    http://code.haskell.org/~thielema/non-negative/+ Library   Build-Depends:     utility-ht >= 0.0.1 && <0.1,-    QuickCheck >= 1.0 && <3+    QuickCheck >= 2.1 && <3   If flag(splitBase)     Build-Depends: base >= 2 && < 5   Else     Build-Depends: base >= 1.0 && < 2 +  Default-Language: Haskell98   GHC-Options:      -Wall   Hs-Source-Dirs:   src   Exposed-Modules:@@ -42,12 +48,15 @@   Other-Modules:     Numeric.NonNegative.ChunkyPrivate -Executable test-  If !flag(buildTests)-    Buildable:      False-+Test-Suite test+  Type: exitcode-stdio-1.0+  Default-Language: Haskell98   Hs-source-dirs:   src, .   GHC-Options:      -Wall+  Build-Depends:+    QuickCheck,+    utility-ht,+    base   Main-Is:          Test/Main.hs   Other-Modules:     Test.Utility
src/Numeric/NonNegative/ChunkyPrivate.hs view
@@ -21,7 +21,7 @@ import Data.Tuple.HT (mapSnd, )  import qualified Data.Monoid as Mn-import Test.QuickCheck (Arbitrary(arbitrary))+import Test.QuickCheck (Arbitrary(arbitrary, shrink))  {- | A chunky non-negative number is a list of non-negative numbers.@@ -199,6 +199,7 @@  instance (NonNeg.C a, Arbitrary a) => Arbitrary (T a) where    arbitrary = liftM Cons arbitrary+   shrink (Cons xs) = map Cons $ shrink xs   {- * Functions that may break invariants -}
src/Numeric/NonNegative/Class.hs view
@@ -6,7 +6,10 @@ Portability :  Haskell 98  A type class for non-negative numbers.-Prominent instances are 'Numeric.NonNegative.Wrapper.T' and peano numbers.+Prominent instances are 'Numeric.NonNegative.Wrapper.T',+peano numbers and types from "Data.Word".+However, there is Monoid class for Word types.+Maybe Word is not a candidate, since it has wrap-around semantics. This class cannot do any checks, but it let you show to the user what arguments your function expects. Thus you must define class instances with care.
src/Numeric/NonNegative/Wrapper.hs view
@@ -18,7 +18,7 @@ import Data.Monoid (Monoid, ) import qualified Data.Monoid as Monoid -import Test.QuickCheck (Arbitrary(arbitrary))+import Test.QuickCheck (Arbitrary(arbitrary, shrink)) import Data.Tuple.HT (mapPair, mapSnd, ) import Control.Monad (liftM) @@ -180,6 +180,7 @@  instance (Num a, Arbitrary a) => Arbitrary (T a) where    arbitrary = liftM (Cons . abs) arbitrary+   shrink (Cons xs) = map (Cons . abs) $ shrink xs   type Int      = T P.Int