ANNOUNCE: GHC 7.0.1 Release Candidate 1

Simon Peyton-Jones simonpj at microsoft.com
Wed Sep 29 08:43:59 EDT 2010


I've  been meaning to write a blog post about this, because it's a significant change.  I'll do this when I get home after ICFP.  Briefly though:

* If you use -XGADTs or -XTypeFamilies (or -fglasgow-exts, which is deprecated) you get -XMonoLocalBinds, which says that local let/where bindings are not auto-generalised.  There's an extensive discussion of the reason for this decision in our paper "Let should not be generalised" and the journal version http://haskell.org/haskellwiki/Simonpj/Talk:OutsideIn

* One of the main times this matters is in situations like 
	foo = runST (bar 5)
	  where bar x = return x
Here 'bar' must have a polymorphic type, in order to be mentioned in runST's argument

* The error message does point out that 'bar' is a possible culprit.  In David's example:
    The following variables have types that mention s
      fill0 :: MBUArr s e -> ST s Int

* The solution is usually to add a type signature for the offending variable (fillO in this case); you can still have polymorphic bindings in let/where, but they need a type signature.

Simon

|  -----Original Message-----
|  From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
|  bounces at haskell.org] On Behalf Of David Fox
|  Sent: 29 September 2010 04:11
|  To: glasgow-haskell-users at haskell.org
|  Subject: Re: ANNOUNCE: GHC 7.0.1 Release Candidate 1
|  
|  I'm seeing errors like this in various places, which I guess are
|  coming from the new type checker:
|  
|  Data/Array/Vector/Prim/BUArr.hs:663:3:
|      Couldn't match type `s' with `s3'
|        because this skolem type variable would escape: `s3'
|      This skolem is bound by the polymorphic type `forall s. ST s a'
|      The following variables have types that mention s
|        fill0 :: MBUArr s e -> ST s Int
|          (bound at Data/Array/Vector/Prim/BUArr.hs:669:5)
|      In the first argument of `runST', namely
|        `(do { marr <- newMBU n;
|               n' <- fill0 marr;
|               unsafeFreezeMBU marr n' })'
|  
|  I would love to hear an explanation about what they mean and what to
|  do about them.  (This one is from uvector.)
|  _______________________________________________
|  Glasgow-haskell-users mailing list
|  Glasgow-haskell-users at haskell.org
|  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list