On Thu, Apr 30, 2009 at 12:44:49PM -0700, Jason Dusek wrote:
> I gather that "...making it possible to use ST code directly
> on IORef's." is what we have today?
No, we have stToIO :: ST RealWorld a -> IO a, but STRef and IORef are
still incompatible types. (I now think that's a good thing, b
I gather that "...making it possible to use ST code directly
on IORef's." is what we have today?
--
Jason Dusek
|...making it possible to use ST code directly on IORef's.|
http://www.mail-archive.com/glasgow-haskell-b...@haskell.org/msg03568.html
_
On Wed, Apr 29, 2009 at 05:26:46PM -0400, Xiao-Yong Jin wrote:
> Between the following two functions
>
> stToIO:: ST RealWorld a -> IO a
> stToIO (ST m) = IO m
>
> unsafeSTToIO :: ST s a -> IO a
> unsafeSTToIO (ST m) = IO (unsafeCoerce# m)
>
> All I can see is that the safe one uses Real
On Wednesday 29 April 2009 5:26:46 pm Xiao-Yong Jin wrote:
> Hi,
>
> Between the following two functions
>
> stToIO:: ST RealWorld a -> IO a
> stToIO (ST m) = IO m
>
> unsafeSTToIO :: ST s a -> IO a
> unsafeSTToIO (ST m) = IO (unsafeCoerce# m)
>
> All I can see is that the safe one uses Rea
The main difference is that the state thread reference can leak out of
the unsafe version:
question :: forall s. IO (STRef s Int)
question = unsafeSTToIO (newSTRef 1)
I was trying to use this to inject the reference into a later ST
computation, but I couldn't figure out how to build an object of
Hi,
Between the following two functions
stToIO:: ST RealWorld a -> IO a
stToIO (ST m) = IO m
unsafeSTToIO :: ST s a -> IO a
unsafeSTToIO (ST m) = IO (unsafeCoerce# m)
All I can see is that the safe one uses RealWorld instead of
an arbitrary thread s used in the unsafe one. I really
don