From: lewie Date: Mon, 28 Feb 2000 21:59:33 +0000 (+0000) Subject: [project @ 2000-02-28 21:59:32 by lewie] X-Git-Tag: Approximately_9120_patches~5085 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=f8e67a2c986fe2b1d81c97874d4c9d60cb027642;p=ghc-hetmet.git [project @ 2000-02-28 21:59:32 by lewie] 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. --- diff --git a/ghc/compiler/parser/Parser.y b/ghc/compiler/parser/Parser.y index 12a9e6e..5b839ec 100644 --- a/ghc/compiler/parser/Parser.y +++ b/ghc/compiler/parser/Parser.y @@ -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) diff --git a/ghc/compiler/typecheck/TcMonoType.lhs b/ghc/compiler/typecheck/TcMonoType.lhs index ce5d681..29ae73f 100644 --- a/ghc/compiler/typecheck/TcMonoType.lhs +++ b/ghc/compiler/typecheck/TcMonoType.lhs @@ -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 diff --git a/ghc/compiler/typecheck/TcSimplify.lhs b/ghc/compiler/typecheck/TcSimplify.lhs index 4de479c..3bd5792 100644 --- a/ghc/compiler/typecheck/TcSimplify.lhs +++ b/ghc/compiler/typecheck/TcSimplify.lhs @@ -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 "" 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 "----------------------" ]) $ diff --git a/ghc/compiler/utils/FiniteMap.lhs b/ghc/compiler/utils/FiniteMap.lhs index 2346105..d4e4931 100644 --- a/ghc/compiler/utils/FiniteMap.lhs +++ b/ghc/compiler/utils/FiniteMap.lhs @@ -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