ANNOUNCE: GHC 7.0.1 Release Candidate 1

Antoine Latter aslatter at gmail.com
Tue Sep 28 23:36:23 EDT 2010


On Tue, Sep 28, 2010 at 10:10 PM, David Fox <ddssff at gmail.com> 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' })'
>

GHC no longer generalizes local bindings - which means that while
previously the 'where' defined function would have had a type:

> fill0 :: forall s .  ... -> ST s Int

Where the elipsis indicates an unspecified portion of the local type signature.

I would recommend writing a type signature, but that requires writing
a type signature for it's helper function:

> fill s i = ...

Except I don't know how to write a type signature for this.

The value 's' passed in is bound by pattern matching on this guy's constructor:

data Stream a = forall s. Stream (s -> Step s a) !s Int

in the top-level function, so I don't even know if it has a type I can name.

I'll try to boil this down to something I can put on hpaste.

Antoine


More information about the Glasgow-haskell-users mailing list