packages feed

AC-HalfInteger 1.1.1 → 1.2.1

raw patch · 2 files changed

+12/−7 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.HalfInteger: instance (Bounded i) => Bounded (HalfInteger i)
- Data.HalfInteger: instance (Eq i) => Eq (HalfInteger i)
- Data.HalfInteger: instance (Integral i) => Num (HalfInteger i)
- Data.HalfInteger: instance (Integral i) => Show (HalfInteger i)
- Data.HalfInteger: instance (Ord i) => Ord (HalfInteger i)
+ Data.HalfInteger: instance Bounded i => Bounded (HalfInteger i)
+ Data.HalfInteger: instance Eq i => Eq (HalfInteger i)
+ Data.HalfInteger: instance Integral i => Num (HalfInteger i)
+ Data.HalfInteger: instance Integral i => Show (HalfInteger i)
+ Data.HalfInteger: instance Ord i => Ord (HalfInteger i)
- Data.HalfInteger: half :: (Num i) => HalfInteger i
+ Data.HalfInteger: half :: Integral i => HalfInteger i
- Data.HalfInteger: halve :: i -> HalfInteger i
+ Data.HalfInteger: halve :: Integral i => i -> HalfInteger i
- Data.HalfInteger: isInteger :: (Integral i) => HalfInteger i -> Bool
+ Data.HalfInteger: isInteger :: Integral i => HalfInteger i -> Bool

Files

AC-HalfInteger.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.6
 Name:          AC-HalfInteger
-Version:       1.1.1
+Version:       1.2.1
 Stability:     Experimental
 Synopsis:      Efficient half-integer type.
 
@@ -10,11 +10,15 @@   /half-integers/. That is, it provides a type that can
   represent both normal integers and integers plus a half.
 
+  Changes:
+  * Fixed documentation glitches.
+  * Added Integral contexts to some functions.
+
 Category:      Data, Math, Numerical
 License:       BSD3
 License-file:  Licence.txt
 Author:        Andrew Coppin
-Maintainer:    MathematicalOrchid@hotmail.com
+Maintainer:    Andrew Coppin <MathematicalOrchid@hotmail.com>
 Build-Type:    Simple
 Tested-With:   GHC == 6.10.3
 
Data/HalfInteger.hs view
@@ -40,19 +40,19 @@   @HalfInteger@ values created in various ways to get the
   half-part in.
 -}
-half :: (Num i) => HalfInteger i
+half :: (Integral i) => HalfInteger i
 half = HalfInteger 1
 
 {- |
   Take an integer and halve its value, yielding a @HalfInteger@.
-  This conversion is always exact, and @half . double == id@.
+  This conversion is always exact, and @halve . double == id@.
 -}
-halve :: i -> HalfInteger i
+halve :: (Integral i) => i -> HalfInteger i
 halve = HalfInteger
 
 {- |
   Take a @HalfInteger@ and double its value, yielding a normal integer.
-  This conversion is always exact, and @double . half == id@.
+  This conversion is always exact, and @double . halve == id@.
 -}
 double :: HalfInteger i -> i
 double (HalfInteger x) = x
@@ -89,7 +89,8 @@ 
 {- |
   Convert any number into a @HalfInteger@. The rounding is somewhat
-  unpredictable, but
+  unpredictable, but any value exactly representable as a half integer
+  will be converted exactly.
 -}
 toHalfInteger :: (RealFrac x, Integral i) => x -> HalfInteger i
 toHalfInteger x = HalfInteger (round $ 2 * x)