summaryrefslogtreecommitdiff
path: root/compiler/deSugar/MatchLit.lhs
diff options
context:
space:
mode:
authorMax Bolingbroke <batterseapower@hotmail.com>2011-05-15 18:50:54 +0100
committerMax Bolingbroke <batterseapower@hotmail.com>2011-05-15 19:36:52 +0100
commit3391a03562d4056de7b16cd0f632e6c43ae44cca (patch)
tree22347ea65b37da5e60da9c656270e2f0e6fa423c /compiler/deSugar/MatchLit.lhs
parentee5addccd1929a7368a39b2c88d1b77f0bc8fb73 (diff)
downloadhaskell-3391a03562d4056de7b16cd0f632e6c43ae44cca.tar.gz
Record the original text along with parsed Rationals: fixes #2245
Diffstat (limited to 'compiler/deSugar/MatchLit.lhs')
-rw-r--r--compiler/deSugar/MatchLit.lhs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/deSugar/MatchLit.lhs b/compiler/deSugar/MatchLit.lhs
index be112e09a7..4842b16850 100644
--- a/compiler/deSugar/MatchLit.lhs
+++ b/compiler/deSugar/MatchLit.lhs
@@ -33,6 +33,7 @@ import Literal
import SrcLoc
import Data.Ratio
import Outputable
+import BasicTypes
import Util
import FastString
\end{code}
@@ -124,8 +125,8 @@ hsOverLitKey (OverLit { ol_val = l }) neg = litValKey l neg
litValKey :: OverLitVal -> Bool -> Literal
litValKey (HsIntegral i) False = MachInt i
litValKey (HsIntegral i) True = MachInt (-i)
-litValKey (HsFractional r) False = MachFloat r
-litValKey (HsFractional r) True = MachFloat (-r)
+litValKey (HsFractional r) False = MachFloat (fl_value r)
+litValKey (HsFractional r) True = MachFloat (negate (fl_value r))
litValKey (HsIsString s) neg = ASSERT( not neg) MachStr s
\end{code}
@@ -190,8 +191,8 @@ tidyNPat tidy_lit_pat (OverLit val False _ ty) mb_neg _
mb_rat_lit = case (mb_neg, val) of
(Nothing, HsIntegral i) -> Just (fromInteger i)
(Just _, HsIntegral i) -> Just (fromInteger (-i))
- (Nothing, HsFractional f) -> Just f
- (Just _, HsFractional f) -> Just (-f)
+ (Nothing, HsFractional f) -> Just (fl_value f)
+ (Just _, HsFractional f) -> Just (negate (fl_value f))
_ -> Nothing
mb_str_lit :: Maybe FastString