White space cosmetics only
[ghc-hetmet.git] / compiler / deSugar / Match.lhs
index 2d826f6..a28eb84 100644 (file)
@@ -26,6 +26,7 @@ import Check
 import CoreSyn
 import Literal
 import CoreUtils
+import MkCore
 import DsMonad
 import DsBinds
 import DsGRHSs
@@ -43,6 +44,7 @@ import Maybes
 import Util
 import Name
 import Outputable
+import FastString
 \end{code}
 
 This function is a wrapper of @match@, it must be called from all the parts where 
@@ -111,11 +113,11 @@ dsShadowWarn ctx@(DsMatchContext kind loc) qs
   = putSrcSpanDs loc (warnDs warn)
   where
     warn | qs `lengthExceeds` maximum_output
-         = pp_context ctx (ptext SLIT("are overlapped"))
+         = pp_context ctx (ptext (sLit "are overlapped"))
                      (\ f -> vcat (map (ppr_eqn f kind) (take maximum_output qs)) $$
-                     ptext SLIT("..."))
+                     ptext (sLit "..."))
         | otherwise
-         = pp_context ctx (ptext SLIT("are overlapped"))
+         = pp_context ctx (ptext (sLit "are overlapped"))
                      (\ f -> vcat $ map (ppr_eqn f kind) qs)
 
 
@@ -123,19 +125,19 @@ dsIncompleteWarn :: DsMatchContext -> [ExhaustivePat] -> DsM ()
 dsIncompleteWarn ctx@(DsMatchContext kind loc) pats 
   = putSrcSpanDs loc (warnDs warn)
        where
-         warn = pp_context ctx (ptext SLIT("are non-exhaustive"))
-                            (\_ -> hang (ptext SLIT("Patterns not matched:"))
+         warn = pp_context ctx (ptext (sLit "are non-exhaustive"))
+                            (\_ -> hang (ptext (sLit "Patterns not matched:"))
                                   4 ((vcat $ map (ppr_incomplete_pats kind)
                                                  (take maximum_output pats))
                                      $$ dots))
 
-         dots | pats `lengthExceeds` maximum_output = ptext SLIT("...")
+         dots | pats `lengthExceeds` maximum_output = ptext (sLit "...")
               | otherwise                           = empty
 
 pp_context :: DsMatchContext -> SDoc -> ((SDoc -> SDoc) -> SDoc) -> SDoc
 pp_context (DsMatchContext kind _loc) msg rest_of_msg_fun
-  = vcat [ptext SLIT("Pattern match(es)") <+> msg,
-         sep [ptext SLIT("In") <+> ppr_match <> char ':', nest 4 (rest_of_msg_fun pref)]]
+  = vcat [ptext (sLit "Pattern match(es)") <+> msg,
+         sep [ptext (sLit "In") <+> ppr_match <> char ':', nest 4 (rest_of_msg_fun pref)]]
   where
     (ppr_match, pref)
        = case kind of
@@ -147,16 +149,16 @@ ppr_pats pats = sep (map ppr pats)
 
 ppr_shadow_pats :: HsMatchContext Name -> [Pat Id] -> SDoc
 ppr_shadow_pats kind pats
-  = sep [ppr_pats pats, matchSeparator kind, ptext SLIT("...")]
+  = sep [ppr_pats pats, matchSeparator kind, ptext (sLit "...")]
 
 ppr_incomplete_pats :: HsMatchContext Name -> ExhaustivePat -> SDoc
 ppr_incomplete_pats _ (pats,[]) = ppr_pats pats
 ppr_incomplete_pats _ (pats,constraints) =
-                        sep [ppr_pats pats, ptext SLIT("with"), 
+                        sep [ppr_pats pats, ptext (sLit "with"), 
                              sep (map ppr_constraint constraints)]
 
 ppr_constraint :: (Name,[HsLit]) -> SDoc
-ppr_constraint (var,pats) = sep [ppr var, ptext SLIT("`notElem`"), ppr pats]
+ppr_constraint (var,pats) = sep [ppr var, ptext (sLit "`notElem`"), ppr pats]
 
 ppr_eqn :: (SDoc -> SDoc) -> HsMatchContext Name -> EquationInfo -> SDoc
 ppr_eqn prefixF kind eqn = prefixF (ppr_shadow_pats kind (eqn_pats eqn))
@@ -241,7 +243,7 @@ Make all constructor patterns in column~1 into @ConPats@, notably
 Handle any irrefutable (or ``twiddle'') @LazyPats@.
 \end{itemize}
 \item
-Now {\em unmix} the equations into {\em blocks} [w/ local function
+Now {\em unmix} the equations into {\em blocks} [w\/ local function
 @unmix_eqns@], in which the equations in a block all have variable
 patterns in column~1, or they all have constructor patterns in ...
 (see ``the mixture rule'' in SLPJ).
@@ -267,7 +269,7 @@ Wadler-chapter @match@ (p.~93, last clause), and @match_unmixed_blk@
 corresponds roughly to @matchVarCon@.
 
 \begin{code}
-match :: [Id]            -- Variables rep'ing the exprs we're matching with
+match :: [Id]            -- Variables rep\'ing the exprs we\'re matching with
       -> Type             -- Type of the case expression
       -> [EquationInfo]          -- Info about patterns, etc. (type synonym below)
       -> DsM MatchResult  -- Desugared result!
@@ -386,7 +388,7 @@ which will be scrutinised.  This means:
 Replace variable patterns @x@ (@x /= v@) with the pattern @_@,
 together with the binding @x = v@.
 \item
-Replace the `as' pattern @xp@ with the pattern p and a binding @x = do v@.
+Replace the `as' pattern @x@@p@ with the pattern p and a binding @x = v@.
 \item
 Removing lazy (irrefutable) patterns (you don't want to know...).
 \item
@@ -461,7 +463,7 @@ tidy1 v (VarPat var)
 
 tidy1 v (VarPatOut var binds)
   = do { prs <- dsLHsBinds binds
-       ; return (wrapBind var v . mkDsLet (Rec prs),
+       ; return (wrapBind var v . mkCoreLet (Rec prs),
                  WildPat (idType var)) }
 
        -- case v of { x@p -> mr[] }
@@ -484,7 +486,7 @@ tidy1 v (AsPat (L _ var) pat)
 tidy1 v (LazyPat pat)
   = do { sel_prs <- mkSelectorBinds pat (Var v)
        ; let sel_binds =  [NonRec b rhs | (b,rhs) <- sel_prs]
-       ; return (mkDsLets sel_binds, WildPat (idType v)) }
+       ; return (mkCoreLets sel_binds, WildPat (idType v)) }
 
 tidy1 _ (ListPat pats ty)
   = return (idDsWrapper, unLoc list_ConPat)
@@ -842,8 +844,8 @@ viewLExprEq (e1,_) (e2,_) =
         --        equating different ways of writing a coercion)
         wrap WpHole WpHole = True
         wrap (WpCompose w1 w2) (WpCompose w1' w2') = wrap w1 w1' && wrap w2 w2'
-        wrap (WpCo c) (WpCo c') = tcEqType c c'
-        wrap (WpApp d) (WpApp d') = d == d'
+        wrap (WpCast c)  (WpCast c')  = tcEqType c c'
+        wrap (WpApp d)   (WpApp d')   = d == d'
         wrap (WpTyApp t) (WpTyApp t') = tcEqType t t'
         -- Enhancement: could implement equality for more wrappers
         --   if it seems useful (lams and lets)