[project @ 2000-02-28 21:59:32 by lewie]
authorlewie <unknown>
Mon, 28 Feb 2000 21:59:33 +0000 (21:59 +0000)
committerlewie <unknown>
Mon, 28 Feb 2000 21:59:33 +0000 (21:59 +0000)
Fix signatures w/ implicit parameter types in them (in particular,
correctly handle the case where there are no type variables).  Also
made a few more things Outputable.  Nuke outdated comment in Parser.y.

ghc/compiler/parser/Parser.y
ghc/compiler/typecheck/TcMonoType.lhs
ghc/compiler/typecheck/TcSimplify.lhs
ghc/compiler/utils/FiniteMap.lhs

index 12a9e6e..5b839ec 100644 (file)
@@ -1,6 +1,6 @@
 {-
 -----------------------------------------------------------------------------
-$Id: Parser.y,v 1.25 2000/02/28 09:17:54 simonmar Exp $
+$Id: Parser.y,v 1.26 2000/02/28 21:59:32 lewie Exp $
 
 Haskell grammar.
 
@@ -36,7 +36,6 @@ import GlaExts
 -----------------------------------------------------------------------------
 Conflicts: 14 shift/reduce
        (note: it's currently 21 -- JRL, 31/1/2000)
-        (note2: it's currently 36, but not because of me -- SUP, 15/2/2000 :-)
 
 8 for abiguity in 'if x then y else z + 1'
        (shift parses as 'if x then y else (z + 1)', as per longest-parse rule)
index ce5d681..29ae73f 100644 (file)
@@ -392,6 +392,9 @@ data TcSigInfo
 
        SrcLoc                  -- Of the signature
 
+instance Outputable TcSigInfo where
+    ppr (TySigInfo nm id tyvars theta tau _ inst loc) =
+       ppr nm <+> ptext SLIT("::") <+> ppr tyvars <+> ppr theta <+> ptext SLIT("=>") <+> ppr tau
 
 maybeSig :: [TcSigInfo] -> Name -> Maybe (TcSigInfo)
        -- Search for a particular signature
index 4de479c..3bd5792 100644 (file)
@@ -190,7 +190,8 @@ tcSimplify
                  LIE)                  -- Remaining wanteds; no dups
 
 tcSimplify str local_tvs wanted_lie
-{-
+{- this is just an optimization, and interferes with implicit params,
+   disable it for now.  same goes for tcSimplifyAndCheck
   | isEmptyVarSet local_tvs
   = returnTc (wanted_lie, EmptyMonoBinds, emptyLIE)
 
@@ -270,12 +271,14 @@ tcSimplifyAndCheck
                   TcDictBinds) -- Bindings
 
 tcSimplifyAndCheck str local_tvs given_lie wanted_lie
+{-
   | isEmptyVarSet local_tvs
        -- This can happen quite legitimately; for example in
        --      instance Num Int where ...
   = returnTc (wanted_lie, EmptyMonoBinds)
 
   | otherwise
+-}
   = reduceContext str try_me givens wanteds    `thenTc` \ (binds, frees, irreds) ->
 
        -- Complain about any irreducible ones
@@ -292,6 +295,7 @@ tcSimplifyAndCheck str local_tvs given_lie wanted_lie
     try_me inst 
       -- Does not constrain a local tyvar
       | isEmptyVarSet (tyVarsOfInst inst `intersectVarSet` local_tvs)
+        && (isDict inst || null (getIPs inst))
       = Free
 
       -- When checking against a given signature we always reduce
@@ -432,10 +436,13 @@ data RHS
 
 
 pprAvails avails = vcat (map pprAvail (eltsFM avails))
-    
+
 pprAvail (Avail main_id rhs ids)
   = ppr main_id <> colon <+> brackets (ppr ids) <+> pprRhs rhs
 
+instance Outputable Avail where
+    ppr = pprAvail
+
 pprRhs NoRhs = text "<no rhs>"
 pprRhs (Rhs rhs b) = ppr rhs
 pprRhs (PassiveScSel rhs is) = text "passive" <+> ppr rhs
@@ -503,6 +510,7 @@ reduceContext str try_me givens wanteds
             text "wanted" <+> ppr wanteds,
             text "----", 
             text "avails" <+> pprAvails avails,
+            text "frees" <+> ppr frees,
             text "irreds" <+> ppr irreds,
             text "----------------------"
             ]) $
index 2346105..d4e4931 100644 (file)
@@ -653,6 +653,10 @@ pprX (Branch key elt sz fm_l fm_r)
  = parens (hcat [pprX fm_l, space,
                      ppr key, space, int (IF_GHC(I# sz, sz)), space,
                      pprX fm_r])
+#else
+-- and when not debugging the package itself...
+instance (Outputable key, Outputable elt) => Outputable (FiniteMap key elt) where
+    ppr fm = ppr (fmToList fm)
 #endif
 
 #if 0