logfloat 0.9.1 → 0.9.1.1
raw patch · 4 files changed
+30/−17 lines, 4 filesdep +ghc-prim
Dependencies added: ghc-prim
Files
- Data/Number/LogFloat.hs +5/−4
- Data/Number/PartialOrd.hs +10/−10
- Data/Number/Transfinite.hs +1/−1
- logfloat.cabal +14/−2
Data/Number/LogFloat.hs view
@@ -14,7 +14,7 @@ -- {-# OPTIONS_GHC -ddump-rules -ddump-simpl-stats #-} -{-# OPTIONS_GHC -Wall -fwarn-tabs -Werror #-}+{-# OPTIONS_GHC -Wall -fwarn-tabs #-} -- Unfortunately we need -fglasgow-exts in order to actually pick -- up on the rules (see -ddump-rules). The -frewrite-rules flag@@ -24,6 +24,7 @@ {-# OPTIONS_GHC -O2 -fvia-C -optc-O3 -fexcess-precision -fglasgow-exts #-} -- Version History+-- (v0.9.1) Fixed some PartialOrd stuff and sanitized documentation -- (v0.9.0) s/toFractional/realToFrac/g. -- Also moved realToFrac and log to Transfinite -- (v0.8.6) Removed buggy RULES@@ -132,8 +133,8 @@ -- | Reduce the number of constant string literals we need to store. errorOutOfRange :: String -> a-errorOutOfRange fun = error $ "Data.Number.LogFloat."++fun- ++ ": argument out of range"+errorOutOfRange fun = error $! "Data.Number.LogFloat."++fun+ ++ ": argument out of range" -- | We need these guards in order to ensure some invariants.@@ -186,7 +187,7 @@ instance PartialOrd LogFloat where cmp (LogFloat x) (LogFloat y) | isNaN x || isNaN y = Nothing- | otherwise = Just (x `compare` y)+ | otherwise = Just $! x `compare` y -- | A constructor which does semantic conversion from normal-domain
Data/Number/PartialOrd.hs view
@@ -3,7 +3,7 @@ , UndecidableInstances #-} -{-# OPTIONS_GHC -Wall -fwarn-tabs -Werror #-}+{-# OPTIONS_GHC -Wall -fwarn-tabs #-} ---------------------------------------------------------------- -- ~ 2008.08.29@@ -74,22 +74,22 @@ infix 4 `gt`, `ge`, `eq`, `ne`, `le`, `lt` instance (Ord a) => PartialOrd a where- cmp x y = Just (compare x y)- gt x y = Just (x > y)- ge x y = Just (x >= y)- eq x y = Just (x == y)- ne x y = Just (x /= y)- le x y = Just (x <= y)- lt x y = Just (x < y)+ cmp x y = Just $! compare x y+ gt x y = Just $! x > y+ ge x y = Just $! x >= y+ eq x y = Just $! x == y+ ne x y = Just $! x /= y+ le x y = Just $! x <= y+ lt x y = Just $! x < y -- The instances inherited from Ord are wrong instance PartialOrd Float where cmp x y | isNaN x || isNaN y = Nothing- | otherwise = Just (x `compare` y)+ | otherwise = Just $! x `compare` y instance PartialOrd Double where cmp x y | isNaN x || isNaN y = Nothing- | otherwise = Just (x `compare` y)+ | otherwise = Just $! x `compare` y ---------------------------------------------------------------- ----------------------------------------------------------- fin.
Data/Number/Transfinite.hs view
@@ -7,7 +7,7 @@ -- Glasgow extensions needed to enable the # kind {-# OPTIONS_GHC -cpp -fglasgow-exts #-} -{-# OPTIONS_GHC -Wall -fwarn-tabs -Werror #-}+{-# OPTIONS_GHC -Wall -fwarn-tabs #-} ---------------------------------------------------------------- -- ~ 2008.08.29
logfloat.cabal view
@@ -1,9 +1,9 @@ ------------------------------------------------------------------- wren ng thornton <wren@community.haskell.org> ~ 2008.08.29+-- wren ng thornton <wren@community.haskell.org> ~ 2008.10.12 ---------------------------------------------------------------- Name: logfloat-Version: 0.9.1+Version: 0.9.1.1 Cabal-Version: >= 1.2 Build-Type: Simple Stability: provisional@@ -21,11 +21,23 @@ probabilities as is done in Hidden Markov Models. It is also helpful for preventing overflow. +-- Doing it this way uncovers a bug in Cabal-1.2.3.0:+-- "Setup.hs: 'parseField' called on a non-field. This is a bug."+--Flag hiddenPrim+-- Description: Use GHC 6.10's newly hidden package for GHC.Prim+-- if impl(ghc >= 6.10)+-- Default: true+-- else+-- Default: false+ Library Exposed-Modules: Data.Number.LogFloat , Data.Number.Transfinite , Data.Number.PartialOrd Build-Depends: base+-- if flag(hiddenPrim)+ if impl(ghc >= 6.10)+ Build-Depends: ghc-prim ---------------------------------------------------------------- ----------------------------------------------------------- fin.