Big tidy-up of deriving code
[ghc-hetmet.git] / compiler / typecheck / Inst.lhs
index b0fe5f9..49fba35 100644 (file)
@@ -333,11 +333,10 @@ mkPredName uniq loc pred_ty
            IParam ip  _ -> getOccName (ipNameName ip)
            EqPred ty  _ -> mkEqPredCoOcc baseOcc
              where
-               -- we use the outermost tycon of the lhs, which must be a type
-               -- function, as the base name for an equality
+               -- we use the outermost tycon of the lhs, if there is one, to
+               -- improve readability of Core code
                baseOcc = case splitTyConApp_maybe ty of
-                           Nothing      -> 
-                             pprPanic "Inst.mkPredName:" (ppr ty)
+                           Nothing      -> mkOccName tcName "$"
                             Just (tc, _) -> getOccName tc
 \end{code}
 
@@ -752,7 +751,7 @@ lookupSimpleInst (Dict {tci_pred = pred, tci_loc = loc})
        (theta, _) = tcSplitPhiTy dfun_rho
        src_loc    = instLocSpan loc
        dfun       = HsVar dfun_id
-       tys        = map (substTyVar tenv') tyvars
+       tys        = substTyVars tenv' tyvars
     ; if null theta then
        returnM (GenInst [] (L src_loc $ HsWrap (mkWpTyApps tys) dfun))
       else do