"Could not deduce (MArray (STUArray s) Int (ST s)) from context ()" when applying runST

Peter Gammie peteg42 at gmail.com
Tue Jul 21 19:24:39 EDT 2009


On 22/07/2009, at 9:16 AM, Christian Klauser wrote:

> Thank you, works indeed with the strict ST monad. Didn't think of  
> that. But
> makes kind of sense not to define these instances, since unboxed  
> values
> cannot have their computation delayed. It's a bit unfortunate,  
> however, that
> a single use
> of an unboxed array "forces" the whole state thread to become strict.

Hmm. Have you seen the strictToLazyST function?

http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Monad-ST-Lazy.html#v%3AstrictToLazyST

cheers
peter


More information about the Glasgow-haskell-users mailing list