logfloat 0.13.1 → 0.13.2
raw patch · 6 files changed
+38/−11 lines, 6 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- VERSION +2/−0
- logfloat.cabal +2/−2
- src/Data/Number/LogFloat.hs +26/−8
- src/Data/Number/PartialOrd.hs +2/−0
- src/Data/Number/RealToFrac.hs +3/−0
- src/Data/Number/Transfinite.hs +3/−1
VERSION view
@@ -1,3 +1,5 @@+0.13.2 (2015-03-23):+ - Preliminary fixes for dealing with type-roles in GHC 7.10 0.13.1 (2015-03-10): - Fixed a major bug in sum 0.13 (2015-02-17):
logfloat.cabal view
@@ -1,5 +1,5 @@ ------------------------------------------------------------------- wren gayle romano <wren@community.haskell.org> ~ 2015.03.10+-- wren gayle romano <wren@community.haskell.org> ~ 2015.03.23 ---------------------------------------------------------------- -- By and large Cabal >=1.2 is fine; but >= 1.6 gives tested-with:@@ -8,7 +8,7 @@ Build-Type: Simple Name: logfloat-Version: 0.13.1+Version: 0.13.2 Stability: experimental Homepage: http://code.haskell.org/~wren/ Author: wren gayle romano
src/Data/Number/LogFloat.hs view
@@ -1,6 +1,6 @@ -- CPP and GeneralizedNewtypeDeriving are needed for IArray UArray instance -- FFI is for log1p-{-# LANGUAGE CPP, ForeignFunctionInterface #-}+{-# LANGUAGE CPP, ForeignFunctionInterface, MultiParamTypeClasses #-} -- We don't put these in LANGUAGE, because it's CPP guarded for GHC only {-# OPTIONS_GHC -XGeneralizedNewtypeDeriving #-} @@ -9,7 +9,7 @@ {-# OPTIONS_GHC -O2 -fexcess-precision -fenable-rewrite-rules #-} ------------------------------------------------------------------- ~ 2015.02.17+-- ~ 2015.03.23 -- | -- Module : Data.Number.LogFloat -- Copyright : Copyright (c) 2007--2015 wren gayle romano@@ -71,9 +71,14 @@ -- Hugs (Sept 2006) doesn't use the generic wrapper in base:Unsafe.Coerce -- so we'll just have to go back to the original source. #ifdef __HUGS__-import Hugs.IOExts (unsafeCoerce)+import Hugs.IOExts (unsafeCoerce) #elif __NHC__ import NonStdUnsafeCoerce (unsafeCoerce)+#elif __GLASGOW_HASKELL__ >= 710+-- When we can, do...+import Data.Coerce (coerce)+-- When we can't, pretend.+import Unsafe.Coerce (unsafeCoerce) #endif #ifdef __GLASGOW_HASKELL__@@ -132,25 +137,32 @@ ( Eq , Ord -- Should we really perpetuate the Ord lie? #ifdef __GLASGOW_HASKELL__- -- At least GHC 6.8.2 can derive these (without- -- GeneralizedNewtypeDeriving). The H98 Report doesn't include- -- them among the options for automatic derivation though.+ -- The H98 Report doesn't include these among the options for+ -- automatic derivation. But GHC >= 6.8.2 (at least) can derive+ -- them (even without GeneralizedNewtypeDeriving). However,+ -- GHC >= 7.10 can't derive @IArray UArray@ thanks to the new+ -- type-role stuff! since 'UArray' is declared to be nominal+ -- in both arguments...+#if __GLASGOW_HASKELL__ < 710 , IArray UArray+#endif , Storable #endif ) -#if __HUGS__ || __NHC__+#if __HUGS__ || __NHC__ || (__GLASGOW_HASKELL__ >= 710) -- TODO: Storable instance. Though Foreign.Storable isn't in Hugs(Sept06) -- These two operators make it much easier to read the instance. -- Hopefully inlining everything will get rid of the eta overhead. -- <http://matt.immute.net/content/pointless-fun>+(~>) :: (a -> b) -> (d -> c) -> (b -> d) -> a -> c {-# INLINE (~>) #-} infixr 2 ~> f ~> g = (. f) . (g .) +($::) :: a -> (a -> b) -> b {-# INLINE ($::) #-} infixl 1 $:: ($::) = flip ($)@@ -158,8 +170,14 @@ {-# INLINE logFromLFAssocs #-} logFromLFAssocs :: [(Int, LogFloat)] -> [(Int, Double)]+#if __GLASGOW_HASKELL__ >= 710+logFromLFAssocs = coerce+#else logFromLFAssocs = unsafeCoerce+#endif +-- BUG: 'UArray' is declared to be nominal in the second type, so+-- these two are unsafe! {-# INLINE logFromLFUArray #-} logFromLFUArray :: UArray a LogFloat -> UArray a Double logFromLFUArray = unsafeCoerce@@ -187,7 +205,7 @@ -- Apparently this method was added in base-2.0/GHC-6.6 but Hugs -- (Sept 2006) doesn't have it. Not sure about NHC's base-#if __HUGS__ > 200609+#if (!(defined(__HUGS__))) || (__HUGS__ > 200609) {-# INLINE numElements #-} numElements = numElements . logFromLFUArray #endif
src/Data/Number/PartialOrd.hs view
@@ -1,3 +1,5 @@+-- TODO: in GHC 7.10 OverlappingInstances is deprecated in favor+-- of per-instance OVERLAPPING/OVERLAPPABLE/OVERLAPS pragmata. {-# LANGUAGE OverlappingInstances , FlexibleInstances , UndecidableInstances
src/Data/Number/RealToFrac.hs view
@@ -1,3 +1,6 @@+-- TODO: in GHC 7.10 OverlappingInstances is deprecated in favor+-- of per-instance OVERLAPPING/OVERLAPPABLE/OVERLAPS pragmata.+-- -- Needed to ensure correctness, and because we can't guarantee rules fire -- The MagicHash is for unboxed primitives (-fglasgow-exts also works) -- We only need MagicHash if on GHC, but we can't hide it in an #ifdef
src/Data/Number/Transfinite.hs view
@@ -3,7 +3,7 @@ {-# OPTIONS_GHC -O2 -fenable-rewrite-rules #-} ------------------------------------------------------------------- ~ 2013.05.11+-- ~ 2015.03.23 -- | -- Module : Data.Number.Transfinite -- Copyright : Copyright (c) 2007--2015 wren gayle romano@@ -181,6 +181,8 @@ log :: (Floating a, Transfinite a) => a -> a {-# SPECIALIZE log :: Double -> Double #-} {-# SPECIALIZE log :: Float -> Float #-}+{-# INLINE [0] log #-}+-- TODO: should we use NOINLINE or [~0] to avoid the possibility of code bloat? log x = case x `cmp` 0 of Just GT -> Prelude.log x Just EQ -> negativeInfinity