X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FhsSyn%2FHsLit.lhs;h=edf08e37c9371d8c2a7efc41eb0b95bc5410336d;hb=c1681a73fa4ca4cf8758264ae387ac09a9e900d8;hp=c6d7e5dbeaf1b96222e2907cc1a598c36a219772;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/hsSyn/HsLit.lhs b/compiler/hsSyn/HsLit.lhs index c6d7e5d..edf08e3 100644 --- a/compiler/hsSyn/HsLit.lhs +++ b/compiler/hsSyn/HsLit.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[HsLit]{Abstract syntax: source-language literals} @@ -55,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. @@ -67,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} @@ -93,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}