packages feed

FloatingHex 0.3 → 0.4

raw patch · 3 files changed

+17/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Numbers.FloatingHex: class RealFloat a => FloatingHexReader a

Files

CHANGES.md view
@@ -1,7 +1,11 @@ * Hackage: <http://hackage.haskell.org/package/FloatingHex> * GitHub:  <http://github.com/LeventErkok/FloatingHex/> -* Latest Hackage released version: 0.3, 2017-01-15+* Latest Hackage released version: 0.4, 2017-01-15++### Version 0.4, 2017-01-15++  * Export the new FloatingHexReader class. Useful when used as an API.  ### Version 0.3, 2017-01-15 
Data/Numbers/FloatingHex.hs view
@@ -12,7 +12,14 @@ -- We slightly diverge from the standard and do not allow for the "floating-suffix," -- as the type inference of Haskell makes this unnecessary. ------------------------------------------------------------------------------module Data.Numbers.FloatingHex (hf, readHFloat, showHFloat) where+module Data.Numbers.FloatingHex (+        -- ** QuasiQuoting+        hf+        -- ** Reading hex-floats+        , FloatingHexReader(..)+        -- ** Showing hex-floats+        , showHFloat+        ) where  import Data.Char  (toLower) import Data.Ratio ((%))@@ -23,10 +30,10 @@ import           Language.Haskell.TH.Quote  -- | Due to intricacies of conversion between--- float/doubles (see <https://ghc.haskell.org/trac/ghc/ticket/3676>), we explicitly introduce+-- @Float@ and @Double@ types (see <http://ghc.haskell.org/trac/ghc/ticket/3676>), we explicitly introduce -- a class to do the reading properly. class RealFloat a => FloatingHexReader a where-   -- | Convert a hex-float to a Real-Float, if possible+   -- | Convert a hex-float from a string, if possible.    readHFloat :: String -> Maybe a  -- | The Float instance@@ -118,7 +125,7 @@                   Just d  -> return (TH.LitP (TH.RationalL (toRational d)))                   Nothing -> fail $ "Invalid hexadecimal floating point number: |" ++ s ++ "|" --- | Show a floating-point value in the hexadecimal format, similar to the @%a@ modifier in C's printf.+-- | Show a floating-point value in the hexadecimal format, similar to the @%a@ specifier in C's printf. -- -- >>> showHFloat (212.21 :: Double) "" -- "0x1.a86b851eb851fp7"
FloatingHex.cabal view
@@ -1,5 +1,5 @@ Name:                FloatingHex-Version:             0.3+Version:             0.4 Synopsis:            Read and write hexadecimal floating point numbers Description:         Read and write hexadecimal floating point numbers. Provides a quasiquoter for                      entering hex-float literals, and a function for printing them in hexadecimal.