Commits

Bryan O'Sullivan  committed 397dc3b

Fix up docs around Number

  • Participants
  • Parent commits 02863e7

Comments (0)

Files changed (3)

File Data/Attoparsec/ByteString/Char8.hs

 {-# LANGUAGE BangPatterns, FlexibleInstances, TypeFamilies,
     TypeSynonymInstances, GADTs #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# OPTIONS_GHC -fno-warn-orphans -fno-warn-warnings-deprecations #-}
 
 -- |
 -- Module      :  Data.Attoparsec.ByteString.Char8
 --
 -- The syntax accepted by this parser is the same as for 'rational'.
 --
--- /Note/: This function is almost ten times faster than 'rational',
--- but is slightly less accurate.
---
--- The 'Double' type supports about 16 decimal places of accuracy.
--- For 94.2% of numbers, this function and 'rational' give identical
--- results, but for the remaining 5.8%, this function loses precision
--- around the 15th decimal place.  For 0.001% of numbers, this
--- function will lose precision at the 13th or 14th decimal place.
---
 -- This function does not accept string representations of \"NaN\" or
 -- \"Infinity\".
 double :: Parser Double
 --
 -- The syntax accepted by this parser is the same as for 'rational'.
 --
--- /Note/: This function is almost ten times faster than 'rational'.
--- On integral inputs, it gives perfectly accurate answers, and on
--- floating point inputs, it is slightly less accurate than
--- 'rational'.
---
--- This function does not accept string representations of \"NaN\" or
--- \"
+ -- This function does not accept string representations of \"NaN\" or
+ -- \"Infinity\".
 number :: Parser Number
 number = scientifically $ \s ->
             let e = Sci.base10Exponent s
             in if e >= 0
                then I (c * 10 ^ e)
                else D (Sci.toRealFloat s)
+{-# DEPRECATED number "Use 'scientific' instead." #-}
 
 -- | Parse a scientific number.
 --

File Data/Attoparsec/Number.hs

 -- Stability   :  experimental
 -- Portability :  unknown
 --
+-- This module is deprecated, and both the module and 'Number' type
+-- will be removed in the next major release.  Use the
+-- <http://hackage.haskell.org/package/scientific scientific> package
+-- and the 'Data.Scientific.Scientific' type instead.
+--
 -- A simple number type, useful for parsing both exact and inexact
 -- quantities without losing much precision.
-module Data.Attoparsec.Number ( Number(..) ) where
+module Data.Attoparsec.Number
+    {-# DEPRECATED "This module will be removed in the next major release." #-}
+    (
+      Number(..)
+    ) where
 
 import Control.DeepSeq (NFData(rnf))
 import Data.Data (Data)
 
 -- | A numeric type that can represent integers accurately, and
 -- floating point numbers to the precision of a 'Double'.
+--
+-- /Note/: this type is deprecated, and will be removed in the next
+-- major release.  Use the 'Data.Scientific.Scientific' type instead.
 data Number = I !Integer
             | D {-# UNPACK #-} !Double
               deriving (Typeable, Data)
+{-# DEPRECATED Number "Use Scientific instead." #-}
 
 instance Show Number where
     show (I a) = show a

File Data/Attoparsec/Text.hs

 {-# LANGUAGE BangPatterns, FlexibleInstances, TypeSynonymInstances #-}
+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
 
 -- |
 -- Module      :  Data.Attoparsec.Text
 --
 -- The syntax accepted by this parser is the same as for 'rational'.
 --
--- /Note/: This function is almost ten times faster than 'rational',
--- but is slightly less accurate.
---
--- The 'Double' type supports about 16 decimal places of accuracy.
--- For 94.2% of numbers, this function and 'rational' give identical
--- results, but for the remaining 5.8%, this function loses precision
--- around the 15th decimal place.  For 0.001% of numbers, this
--- function will lose precision at the 13th or 14th decimal place.
---
 -- This function does not accept string representations of \"NaN\" or
 -- \"Infinity\".
 double :: Parser Double
 --
 -- The syntax accepted by this parser is the same as for 'rational'.
 --
--- /Note/: This function is almost ten times faster than 'rational'.
--- On integral inputs, it gives perfectly accurate answers, and on
--- floating point inputs, it is slightly less accurate than
--- 'rational'.
---
 -- This function does not accept string representations of \"NaN\" or
 -- \"Infinity\".
 number :: Parser Number
             in if e >= 0
                then I (c * 10 ^ e)
                else D (Sci.toRealFloat s)
+{-# DEPRECATED number "Use 'scientific' instead." #-}
 
 -- | Parse a scientific number.
 --