ANNOUNCE: GHC 7.4.1 Release Candidate 1
aslatter at gmail.com
Fri Dec 23 15:18:46 CET 2011
On Fri, Dec 23, 2011 at 3:04 AM, Simon Peyton-Jones
<simonpj at microsoft.com> 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
> Why the change. You'll remember that over the last year GHC has changed not to generalise local lets: http://hackage.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7
> 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.
More information about the Glasgow-haskell-users