packages feed

semirings 0.4 → 0.4.1

raw patch · 3 files changed

+14/−6 lines, 3 filesdep ~hashable

Dependency ranges changed: hashable

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.4.1: [2019.05.04]+-------------------+* Remove unlawful and useless `Ring` instance for `GHC.Natural.Natural`.+* Correct behaviour/docs of Data.Semiring.(^)+ 0.4: [2019.05.01] ----------------- * Remove unlawful instances of `Ring` (thanks to @Bodigrim for noticing these)
Data/Semiring.hs view
@@ -52,7 +52,7 @@   ) where  import           Control.Applicative (Applicative(..), Const(..), liftA2)-import           Data.Bool (Bool(..), (||), (&&))+import           Data.Bool (Bool(..), (||), (&&), otherwise) #if MIN_VERSION_base(4,7,0) import           Data.Coerce (Coercible, coerce) #endif@@ -93,7 +93,7 @@ import qualified Data.Map as Map #endif import           Data.Monoid (Monoid(..), Dual(..))-import           Data.Ord (Ord)+import           Data.Ord (Ord((<))) #if MIN_VERSION_base(4,6,0) import           Data.Ord (Down(..)) #endif@@ -117,6 +117,7 @@ import           Foreign.Ptr (IntPtr, WordPtr) import           Foreign.Storable (Storable) import           GHC.Enum (Enum, Bounded)+import           GHC.Err (error) import           GHC.Float (Float, Double) #if MIN_VERSION_base(4,6,1) import           GHC.Generics (Generic,Generic1)@@ -151,14 +152,17 @@ --------------------------------------------------------------------}  -- | Raise a number to a non-negative integral power.--- If the power is negative, this will return 'zero'.+-- If the power is negative, this will call 'error'. {-# SPECIALISE [1] (^) ::         Integer -> Integer -> Integer,         Integer -> Int -> Integer,         Int -> Int -> Int #-} {-# INLINABLE [1] (^) #-} -- See note [Inlining (^)] (^) :: (Semiring a, Integral b) => a -> b -> a-x ^ y = getMul (stimes y (Mul x))+x ^ y+  | y < 0 = error "Data.Semiring.^: negative power"+  | y == 0 = one+  | otherwise = getMul (stimes y (Mul x))  {- Note [Inlining (^)]    ~~~~~~~~~~~~~~~~~~~@@ -786,7 +790,6 @@ deriveRing(CChar) deriveRing(IntPtr) deriveRing(WordPtr)-deriveRing(Natural)  #if !HOST_OS_WINDOWS deriveRing(CCc)
semirings.cabal view
@@ -1,6 +1,6 @@ name:          semirings category:      Algebra, Data, Data Structures, Math, Maths, Mathematics-version:       0.4+version:       0.4.1 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE