[get rid of as patterns on variables except when needed for type coercions
John Meacham <john@repetae.net>**20060407143003] hunk ./E/FromHs.hs 469
-    cExpr (HsAsPat n' (HsVar n)) = do
-        cv <- lookupCoercion (toName Val n')
-        let t = getAssump n
-        case cv of
-            -- Left t' -> return $ foldl eAp (EVar (tv n)) (map tipe $ specialize t t')
-            Right c -> applyCoersion c $ EVar (tv n)
hunk ./E/FromHs.hs 513
+    cExpr (HsVar n) = do
+        return (EVar (tv n))
+    cExpr (HsAsPat n' (HsVar n)) = do
+        cv <- lookupCoercion (toName Val n')
+        let t = getAssump n
+        case cv of
+            -- Left t' -> return $ foldl eAp (EVar (tv n)) (map tipe $ specialize t t')
+            Right c -> applyCoersion c $ EVar (tv n)
hunk ./FrontEnd/Rename.hs 710
-    wrapInAsPat (HsVar hsName')
+    return (HsVar hsName')
+--    wrapInAsPat (HsVar hsName')
hunk ./FrontEnd/Rename.hs 860
-    pe <- wrapInAsPat (HsVar (nameName v_error))
+    let pe = (HsVar (nameName v_error))
hunk ./FrontEnd/Rename.hs 898
-                    vars' <- mapM wrapInAsPat (map HsVar vars)
+                    let vars' = (map HsVar vars)
hunk ./FrontEnd/Tc/Main.hs 45
-tcKnownApp e nname vname as typ = do
+tcKnownApp e coerce vname as typ = do
hunk ./FrontEnd/Tc/Main.hs 51
-    addCoerce nname (ctAp ts)
+    e' <- if coerce then doCoerce (ctAp ts) e else return e
+    --addCoerce nname (ctAp ts)
hunk ./FrontEnd/Tc/Main.hs 62
-    return (e,nas)
+    return (e',nas)
hunk ./FrontEnd/Tc/Main.hs 64
-tcApps e@(HsAsPat n (HsVar v)) as typ = do
+tcApps e@(HsVar v) as typ = do
hunk ./FrontEnd/Tc/Main.hs 66
-    let nname = toName Val n
-    when (dump FD.BoxySteps) $ liftIO $ putStrLn $ "tcApps: " ++ (show nname ++ "@" ++ show vname)
+    --let nname = toName Val n
+    when (dump FD.BoxySteps) $ liftIO $ putStrLn $ "tcApps: " ++ (show vname)
hunk ./FrontEnd/Tc/Main.hs 71
-    tcKnownApp e nname vname as typ
+    tcKnownApp e True vname as typ
hunk ./FrontEnd/Tc/Main.hs 78
-    tcKnownApp e nname vname as typ
+    tcKnownApp e False vname as typ
hunk ./FrontEnd/Tc/Main.hs 115
+wrapInAsPat :: HsExp -> Tc (HsExp,Name)
+wrapInAsPat e = do
+    nn <- newUniq
+    let n = toName Val ("As@",show nn)
+    return (HsAsPat (nameName n) e, n)
+
+
hunk ./FrontEnd/Tc/Main.hs 131
-tiExpr (HsAsPat n (HsVar v)) typ = do
+tiExpr (HsVar v) typ = do
hunk ./FrontEnd/Tc/Main.hs 135
-    if (toName Val v `Set.member` rc) then
-        tell mempty { outKnots = [(toName Val n,toName Val v)] }
-      else do addCoerce (toName Val n) f
-    return (HsAsPat n $ HsVar v)
+    if (toName Val v `Set.member` rc) then do
+        (e',n) <- wrapInAsPat (HsVar v)
+        tell mempty { outKnots = [(n,toName Val v)] }
+        return e'
+      else do
+        doCoerce f (HsVar v)
hunk ./FrontEnd/Tc/Main.hs 142
-tiExpr (HsAsPat ap (HsCase e alts)) typ = withContext (simpleMsg $ "in the case expression\n   case " ++ show e ++ " of ...") $ do
+tiExpr (HsCase e alts) typ = withContext (simpleMsg $ "in the case expression\n   case " ++ show e ++ " of ...") $ do
hunk ./FrontEnd/Tc/Main.hs 146
-    addToCollectedEnv (Map.singleton (toName Val ap) typ)
-    return (HsAsPat ap (HsCase e' alts'))
+    (ne,ap) <- wrapInAsPat (HsCase e' alts')
+    addToCollectedEnv (Map.singleton ap typ)
+    return ne
hunk ./FrontEnd/Tc/Main.hs 150
-tiExpr ec@HsCase {} typ = do
-    nn <- newUniq
-    let n = toName Val ("As@",show nn)
-    tiExpr (HsAsPat (nameName n) ec) typ
hunk ./FrontEnd/Tc/Main.hs 824
-makeBindGroup' sigEnv (d:ds)
-   = case Map.lookup funName sigEnv of
-        Nothing -- no type sig for this equation
-           -> (restExpls, d:restImpls)
-        Just scheme  -- this one has a type sig
-           -> ((scheme, d):restExpls, restImpls)
+makeBindGroup' sigEnv (d:ds) = case Map.lookup funName sigEnv of
+        Nothing -> (restExpls, d:restImpls)
+        Just scheme -> ((scheme, d):restExpls, restImpls)