ANNOUNCE: GHC 7.4.1 Release Candidate 1

Antoine Latter aslatter at
Fri Dec 23 15:18:46 CET 2011

On Fri, Dec 23, 2011 at 3:04 AM, Simon Peyton-Jones
<simonpj at> wrote:
> Yes, it's expected; it's also the behaviour of GHC 6.12 etc.
> Here what is happening.  You define
>        result = undefined
> What type does it get?  In 6.12, and 7.4, it gets type
>        result :: forall b. b
> So the two uses of 'result' in the two branches of the case have no effect on each other.
> But in 7.2 it was *not generalised*, so we got
>        result :: f2 a
> And now the two uses *do* affect each other.

Thanks for the explanation.

So the 'where' binding in the following does not get generalized
because it could not have been written at the top level, correct?

cast :: (Typeable a, Typeable b) => a -> Maybe b
cast x = r
         r = if typeOf x == typeOf (fromJust r)
               then Just $ unsafeCoerce x
               else Nothing

> Why the change. You'll remember that over the last year GHC has changed not to generalise local lets:
> I relaxed the rule in 7.2, as discussed in "Which bindings are affected?" in that post. For reasons I have not investigated, 7.2 *still* doesn't generalise 'result'; but 7.4 correctly does.
> Simon

More information about the Glasgow-haskell-users mailing list