git.iko.soy/typeable/attoparsec
on master help sign in
Make the Number type strict
commite22d339621fef57f12f53ff506fe461e721b45d5 authorBryan O'Sullivan <bos@serpentine.com> dateWed 16 Feb 2011, 00:10 (16 years ago) parentc5f8c13
1 file changed+2−6
Data/Attoparsec/Number.hs+2−6
Data/Attoparsec/Number.hs+2−6
@@ -10,10 +10,6 @@
1010--
1111-- A simple number type, useful for parsing both exact and inexact
1212-- quantities without losing much precision.
13−--
14−-- The constructors are non-strict, but numeric operations are strict
15−-- just in case you go nuts and try to use this type for actual
16−-- arithmetic.
1713module Data.Attoparsec.Number
1814 (
1915 Number(..)
@@ -25,8 +21,8 @@ import Data.Typeable (Typeable)
2521
2622-- | A numeric type that can represent integers accurately, and
2723-- floating point numbers to the precision of a 'Double'.
28−data Number = I Integer
29− | D Double
24+data Number = I {-# UNPACK #-} !Integer
25+ | D {-# UNPACK #-} !Double
3026 deriving (Typeable, Data)
3127
3228instance Show Number where