Fix CodingStyle#Warnings URLs
[ghc-hetmet.git] / compiler / hsSyn / HsLit.lhs
index c6d7e5d..c110ba4 100644 (file)
@@ -1,9 +1,17 @@
 %
+% (c) The University of Glasgow 2006
 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
 %
 \section[HsLit]{Abstract syntax: source-language literals}
 
 \begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 module HsLit where
 
 #include "HsVersions.h"
@@ -55,6 +63,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 +76,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 +108,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}