[project @ 2001-06-11 12:24:51 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcGenDeriv.lhs
index 758dbaa..1c840a1 100644 (file)
@@ -28,7 +28,7 @@ module TcGenDeriv (
 
 import HsSyn           ( InPat(..), HsExpr(..), MonoBinds(..),
                          Match(..), GRHSs(..), Stmt(..), HsLit(..),
-                         HsBinds(..), StmtCtxt(..), HsType(..),
+                         HsBinds(..), HsType(..), HsDoContext(..),
                          unguardedRHS, mkSimpleMatch, mkMonoBind, andMonoBindList
                        )
 import RdrHsSyn                ( mkHsOpApp, RdrNameMonoBinds, RdrNameHsExpr, RdrNamePat )
@@ -53,7 +53,7 @@ import SrcLoc         ( generatedSrcLoc, SrcLoc )
 import TyCon           ( TyCon, isNewTyCon, tyConDataCons, isEnumerationTyCon,
                          maybeTyConSingleCon, tyConFamilySize
                        )
-import Type            ( isUnLiftedType, isUnboxedType, Type )
+import Type            ( isUnLiftedType, Type )
 import TysPrim         ( charPrimTy, intPrimTy, wordPrimTy, addrPrimTy,
                          floatPrimTy, doublePrimTy
                        )
@@ -63,7 +63,6 @@ import Panic          ( panic, assertPanic )
 import Maybes          ( maybeToBool, orElse )
 import Constants
 import List            ( partition, intersperse )
-import Outputable      ( pprPanic, ppr, pprTrace )
 
 #if __GLASGOW_HASKELL__ >= 404
 import GlaExts         ( fromInt )
@@ -103,7 +102,7 @@ data Foo ... = N1 | N2 ... | Nn | O1 a b | O2 Int | O3 Double b b | ...
 (==) (O3 a1 b1 c1) (O3 a2 b2 c2) = a1 == a2 && b1 == b2 && c1 == c2
 \end{verbatim}
 
-  Note: if we're comparing unboxed things, e.g., if \tr{a1} and
+  Note: if we're comparing unlifted things, e.g., if \tr{a1} and
   \tr{a2} are \tr{Float#}s, then we have to generate
 \begin{verbatim}
 case (a1 `eqFloat#` a2) of
@@ -288,7 +287,7 @@ cmp_eq (O3 a1 b1 c1) (O3 a2 b2 c2)
     }
 \end{verbatim}
 
-  Again, we must be careful about unboxed comparisons.  For example,
+  Again, we must be careful about unlifted comparisons.  For example,
   if \tr{a1} and \tr{a2} were \tr{Int#}s in the 2nd example above, we'd need to
   generate:
 
@@ -324,7 +323,7 @@ gen_Ord_binds tycon
            (if maybeToBool (maybeTyConSingleCon tycon) then
 
 --             cmp_eq_Expr ltTag_Expr eqTag_Expr gtTag_Expr a_Expr b_Expr
--- Wierd.  Was: case (cmp a b) of { LT -> LT; EQ -> EQ; GT -> GT }
+-- Weird.  Was: case (cmp a b) of { LT -> LT; EQ -> EQ; GT -> GT }
 
                cmp_eq_Expr a_Expr b_Expr
             else
@@ -621,7 +620,7 @@ instance ... Ix (Foo ...) where
          False
        }}}
 \end{verbatim}
-(modulo suitable case-ification to handle the unboxed tags)
+(modulo suitable case-ification to handle the unlifted tags)
 
 For a single-constructor type (NB: this includes all tuples), e.g.,
 \begin{verbatim}
@@ -719,7 +718,7 @@ gen_Ix_binds tycon
       where
        stmts = zipWith3Equal "single_con_range" mk_qual as_needed bs_needed cs_needed
                ++
-               [ReturnStmt con_expr]
+               [ResultStmt con_expr tycon_loc]
 
        mk_qual a b c = BindStmt (VarPatIn c)
                                 (HsApp (HsVar range_RDR) 
@@ -908,7 +907,7 @@ gen_Read_binds get_fixity tycon
            | is_infix  = let (h:t) = field_quals in (h:con_qual:t)
            | otherwise = con_qual:field_quals
 
-          stmts = quals ++ [ReturnStmt result_expr]
+          stmts = quals ++ [ResultStmt result_expr tycon_loc]
                
            {-
              c.f. Figure 18 in Haskell 1.1 report.
@@ -1088,7 +1087,7 @@ data Foo ... = ...
 
 con2tag_Foo :: Foo ... -> Int#
 tag2con_Foo :: Int -> Foo ...  -- easier if Int, not Int#
-maxtag_Foo  :: Int             -- ditto (NB: not unboxed)
+maxtag_Foo  :: Int             -- ditto (NB: not unlifted)
 \end{verbatim}
 
 The `tags' here start at zero, hence the @fIRST_TAG@ (currently one)
@@ -1223,7 +1222,7 @@ compare_gen_Case fun lt eq gt a b
       generatedSrcLoc
 
 careful_compare_Case ty lt eq gt a b
-  = if not (isUnboxedType ty) then
+  = if not (isUnLiftedType ty) then
        compare_gen_Case compare_RDR lt eq gt a b
 
     else -- we have to do something special for primitive things...
@@ -1270,7 +1269,7 @@ append_Expr a b = genOpApp a append_RDR b
 
 eq_Expr :: Type -> RdrNameHsExpr -> RdrNameHsExpr -> RdrNameHsExpr
 eq_Expr ty a b
-  = if not (isUnboxedType ty) then
+  = if not (isUnLiftedType ty) then
        genOpApp a eq_RDR  b
     else -- we have to do something special for primitive things...
        genOpApp a relevant_eq_op b