ANNOUNCE: GHC 7.4.1 Release Candidate 1
Simon Peyton-Jones
simonpj at microsoft.com
Fri Dec 23 15:33:00 CET 2011
| So the 'where' binding in the following does not get generalized
| because it could not have been written at the top level, correct?
The other way round. 'where' bindings that could have been written at top level *are* generalised; ones that could not are *not* generalised. See "Which bindings are affected?" in http://hackage.haskell.org/trac/ghc/blog/LetGeneralisationInGhc7, which tries to be precise. If it's hard to understand can I make it easier?
Simon
|
| >>>>>
| cast :: (Typeable a, Typeable b) => a -> Maybe b
| cast x = r
| where
| 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:
| 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.
| >
| > Simon
More information about the Glasgow-haskell-users
mailing list