From: simonpj Date: Tue, 29 Jul 2003 10:15:10 +0000 (+0000) Subject: [project @ 2003-07-29 10:14:57 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~616 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=1a03162e0239a336d297383107a68d06814e8924;p=ghc-hetmet.git [project @ 2003-07-29 10:14:57 by simonpj] Comments only --- diff --git a/ghc/compiler/coreSyn/CoreSyn.lhs b/ghc/compiler/coreSyn/CoreSyn.lhs index 4c70bb3..a074499 100644 --- a/ghc/compiler/coreSyn/CoreSyn.lhs +++ b/ghc/compiler/coreSyn/CoreSyn.lhs @@ -79,12 +79,27 @@ data Expr b -- "b" for the type of binders, | Lam b (Expr b) | Let (Bind b) (Expr b) | Case (Expr b) b [Alt b] -- Binder gets bound to value of scrutinee - -- Invariant: the list of alternatives is ALWAYS EXHAUSTIVE - -- Invariant: the DEFAULT case must be *first*, if it occurs at all + -- Invariant: The list of alternatives is ALWAYS EXHAUSTIVE, + -- meaning that it covers all cases that can occur + -- See the example below + -- + -- Invariant: The DEFAULT case must be *first*, if it occurs at all | Note Note (Expr b) | Type Type -- This should only show up at the top -- level of an Arg +-- An "exhausive" case does not necessarily mention all constructors: +-- data Foo = Red | Green | Blue +-- +-- ...case x of +-- Red -> True +-- other -> f (case x of +-- Green -> ... +-- Blue -> ... ) +-- The inner case does not need a Red alternative, because x can't be Red at +-- that program point. + + type Arg b = Expr b -- Can be a Type type Alt b = (AltCon, [b], Expr b) -- (DEFAULT, [], rhs) is the default alternative diff --git a/ghc/compiler/typecheck/TcDeriv.lhs b/ghc/compiler/typecheck/TcDeriv.lhs index 9ea0190..60b7b2f 100644 --- a/ghc/compiler/typecheck/TcDeriv.lhs +++ b/ghc/compiler/typecheck/TcDeriv.lhs @@ -497,6 +497,11 @@ makeDerivEqns tycl_decls -- Don't want -- instance Eq [A] => Eq A !! + -- Here's a recursive newtype that's actually OK + -- newtype S1 = S1 [T1 ()] + -- newtype T1 a = T1 (StateT S1 IO a ) deriving( Monad ) + -- It's currently rejected. Oh well. + -- Check that eta reduction is OK -- (a) the dropped-off args are identical -- (b) the remaining type args mention