packages feed

Agata 0.2.0.1 → 0.2.1

raw patch · 2 files changed

+35/−4 lines, 2 filesdep ~QuickCheckdep ~taggeddep ~template-haskellPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: QuickCheck, tagged, template-haskell

API changes (from Hackage documentation)

- Test.Agata.Common: piles :: (Integral a, Integral a1, Random a) => a1 -> a -> Gen [a]
- Test.Agata.Instances: instance Buildable a => Buildable (Maybe a)
- Test.Agata.Instances: instance Buildable a => Buildable [a]
+ Test.Agata.Common: instance (Enum b) => Enum (Tagged a b)
+ Test.Agata.Common: instance (Integral b) => Integral (Tagged a b)
+ Test.Agata.Common: instance (Num b) => Num (Tagged a b)
+ Test.Agata.Common: instance (Real b) => Real (Tagged a b)
+ Test.Agata.Instances: instance (Buildable a) => Buildable (Maybe a)
+ Test.Agata.Instances: instance (Buildable a) => Buildable [a]
- Test.Agata.Base: (*>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
+ Test.Agata.Base: (*>) :: (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c
- Test.Agata.Base: (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
+ Test.Agata.Base: (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c
- Test.Agata.Base: agata :: Buildable a => Gen a
+ Test.Agata.Base: agata :: (Buildable a) => Gen a
- Test.Agata.Base: agataEnum :: Buildable a => Int -> (Integer, [a])
+ Test.Agata.Base: agataEnum :: (Buildable a) => Int -> (Integer, [a])
- Test.Agata.Base: agataSC :: Buildable a => Int -> [a]
+ Test.Agata.Base: agataSC :: (Buildable a) => Int -> [a]
- Test.Agata.Base: agataWith :: Buildable a => Strategy a -> Gen a
+ Test.Agata.Base: agataWith :: (Buildable a) => Strategy a -> Gen a
- Test.Agata.Base: automutrec :: Buildable a => Application c (a -> b) -> Application c b
+ Test.Agata.Base: automutrec :: (Buildable a) => Application c (a -> b) -> Application c b
- Test.Agata.Base: autorec :: Buildable a => Application c (a -> b) -> Application c b
+ Test.Agata.Base: autorec :: (Buildable a) => Application c (a -> b) -> Application c b
- Test.Agata.Base: build :: Buildable a => [Builder a]
+ Test.Agata.Base: build :: (Buildable a) => [Builder a]
- Test.Agata.Base: class Buildable a where improve = return dimension = autoDim
+ Test.Agata.Base: class Buildable a
- Test.Agata.Base: dimension :: Buildable a => Dimension a
+ Test.Agata.Base: dimension :: (Buildable a) => Dimension a
- Test.Agata.Base: improve :: Buildable a => a -> Improving a
+ Test.Agata.Base: improve :: (Buildable a) => a -> Improving a
- Test.Agata.Base: inline :: Buildable a => (a -> b) -> [Builder b]
+ Test.Agata.Base: inline :: (Buildable a) => (a -> b) -> [Builder b]
- Test.Agata.Base: mutrec :: Buildable a => Application c (a -> b) -> Application c b
+ Test.Agata.Base: mutrec :: (Buildable a) => Application c (a -> b) -> Application c b
- Test.Agata.Base: nonrec :: Buildable a => Application c (a -> b) -> Application c b
+ Test.Agata.Base: nonrec :: (Buildable a) => Application c (a -> b) -> Application c b
- Test.Agata.Base: rb :: Buildable a => a -> (a -> b) -> Improving b
+ Test.Agata.Base: rb :: (Buildable a) => a -> (a -> b) -> Improving b
- Test.Agata.Base: rec :: Buildable c => Application c (c -> b) -> Application c b
+ Test.Agata.Base: rec :: (Buildable c) => Application c (c -> b) -> Application c b

Files

Agata.cabal view
@@ -1,5 +1,5 @@ Name:		Agata-version:	0.2.0.1+version:	0.2.1 cabal-Version:  >= 1.6 build-type:     Simple license:        BSD3@@ -16,10 +16,10 @@ Library   Build-Depends:      mtl, base>=4&&<5, -    template-haskell<2.8, -    QuickCheck>=2.1&&<2.6, +    template-haskell<2.5, +    QuickCheck>=2.1&&<2.2,      containers, -    tagged>=0.4.2.1&&<1+    tagged==0.0   Exposed-modules:     Test.Agata,     Test.AgataTH,
Test/Agata/Common.hs view
@@ -11,6 +11,37 @@ 
 type Dimension a = Tagged a Int
 
+instance Num b => Num (Tagged a b) where
+  (+) = liftM2 (+)
+  (*) = liftM2 (*)
+  (-) = liftM2 (-)
+  negate = liftM negate
+  abs = liftM abs
+  signum = liftM signum
+  fromInteger = return . fromInteger
+
+instance Real b => Real (Tagged a b) where
+  toRational = toRational . unTagged
+
+instance Integral b => Integral (Tagged a b) where
+  quot = liftM2 quot
+  rem = liftM2 rem
+  div = liftM2 div
+  mod = liftM2 mod
+  quotRem a b = unTagged $ liftM2 quotRem a b >>= \(x,y) -> return (return x,return y)
+  divMod a b = unTagged $ liftM2 divMod a b >>= \(x,y) -> return (return x,return y)
+  toInteger = toInteger . unTagged
+
+instance Enum b => Enum (Tagged a b) where
+  succ = liftM succ
+  pred = liftM pred
+  toEnum = return . toEnum
+  fromEnum = fromEnum . unTagged
+  enumFrom = map return . unTagged . liftM enumFrom
+  enumFromThen a = map return . unTagged . liftM2 enumFromThen a
+  enumFromTo a = map return . unTagged . liftM2 enumFromTo a
+  enumFromThenTo a b = map return . unTagged . liftM3 enumFromThenTo a b
+
 taggedWith :: Tagged b a -> b -> Tagged b a
 taggedWith = const