scoped tyvar

Simon Peyton-Jones simonpj at microsoft.com
Mon Oct 16 12:44:23 EDT 2006


I don't know about Hugs, but you can add an explicit 'forall' to the
type sig for allocUnboxed, to bring the type variables into scope.
http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.
html#scoped-type-variables

S

| -----Original Message-----
| From: Bulat Ziganshin [mailto:bulat.ziganshin at gmail.com]
| Sent: 16 October 2006 17:16
| To: glasgow-haskell-users at haskell.org
| Cc: Simon Peyton-Jones
| Subject: scoped tyvar
| 
| Hello glasgow-haskell-users,
| 
| should the following work in 6.6?
| 
| -- | Alloc the mutable byte vector having `elems` elements of required
type
| allocUnboxed :: (STorIO m s, Integral elems, Unboxed a)
|              => elems -> m (MUVec s a)
| allocUnboxed elems :: m (MUVec s a) =          -- it's line 149
|     allocUnboxedBytes (fromIntegral elems * sizeOfUnboxed
(undefined::a))
| 
| 
| the problem is that it works in 6.6rc1, but user reports that his
| compiler (i think, 6.6 release) can't compile it saying:
| 
| Data/Unboxed.hs:149:0: Parse error in pattern
| 
| may be it's because september's changes in scoped tyvars handling? how
| i can convert this code retaining compatibility with Hugs?
| 
| --
| Best regards,
|  Bulat                          mailto:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list