X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FhsSyn%2FHsLit.lhs;h=edf08e37c9371d8c2a7efc41eb0b95bc5410336d;hb=90dc9026b091be5cca5da4c6cbd3713ecc493361;hp=f4c9cf7a74a758df13b6b23ea9e7c85ce338dda5;hpb=ab22f4e6456820c1b5169d75f5975a94e61f54ce;p=ghc-hetmet.git diff --git a/compiler/hsSyn/HsLit.lhs b/compiler/hsSyn/HsLit.lhs index f4c9cf7..edf08e3 100644 --- a/compiler/hsSyn/HsLit.lhs +++ b/compiler/hsSyn/HsLit.lhs @@ -56,6 +56,7 @@ instance Eq HsLit where data HsOverLit id -- An overloaded literal = HsIntegral Integer (SyntaxExpr id) -- Integer-looking literals; | HsFractional Rational (SyntaxExpr id) -- Frac-looking literals + | HsIsString FastString (SyntaxExpr id) -- String-looking literals -- Before type checking, the SyntaxExpr is 'fromInteger' or 'fromRational' -- After type checking, it is (fromInteger 3) or lit_78; that is, -- the expression that should replace the literal. @@ -68,13 +69,19 @@ data HsOverLit id -- An overloaded literal instance Eq (HsOverLit id) where (HsIntegral i1 _) == (HsIntegral i2 _) = i1 == i2 (HsFractional f1 _) == (HsFractional f2 _) = f1 == f2 + (HsIsString s1 _) == (HsIsString s2 _) = s1 == s2 l1 == l2 = False instance Ord (HsOverLit id) where compare (HsIntegral i1 _) (HsIntegral i2 _) = i1 `compare` i2 compare (HsIntegral _ _) (HsFractional _ _) = LT + compare (HsIntegral _ _) (HsIsString _ _) = LT compare (HsFractional f1 _) (HsFractional f2 _) = f1 `compare` f2 compare (HsFractional f1 _) (HsIntegral _ _) = GT + compare (HsFractional f1 _) (HsIsString _ _) = LT + compare (HsIsString s1 _) (HsIsString s2 _) = s1 `compare` s2 + compare (HsIsString s1 _) (HsIntegral _ _) = GT + compare (HsIsString s1 _) (HsFractional _ _) = GT \end{code} \begin{code} @@ -94,4 +101,5 @@ instance Outputable HsLit where instance Outputable (HsOverLit id) where ppr (HsIntegral i _) = integer i ppr (HsFractional f _) = rational f + ppr (HsIsString s _) = pprHsString s \end{code}