ANNOUNCE: GHC 7.0.1 Release Candidate 1

Dan Doel dan.doel at gmail.com
Tue Sep 28 23:34:32 EDT 2010


On Tuesday 28 September 2010 11:10:58 pm David Fox wrote:
> 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.)

This appears to be due to MonoLocalBinds. The issue boils down to:

  foo = runST (bar 5)
   where bar x = return x

The necessary type for bar is

  forall s. n -> ST s n

n being bound in the type of foo (or, feel free to make it concrete). However, 
GHC will not infer this when the non-generalizing let is turned on. But, no 
rigid s will do, because it's expected to be a quantified variable by runST.

As for why this happens in uvector: -fglasgow-exts is one of the ghc-options 
in the cabal file. Alternately, a type signature could be given.

-- Dan


More information about the Glasgow-haskell-users mailing list