Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-07 Thread Henning Thielemann
Gregory Crosswhite schrieb: I would venture that the condition under which unsafeIOtoST would be safe is if all of the computations you are performing in the IO monad are only changing state that is local to the computation within the ST monad in which you are running. (For example, if there

Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-07 Thread Roman Leshchinskiy
On 08/04/2010, at 01:38, Henning Thielemann wrote: On Apr 6, 2010, at 5:30 PM, Roman Leshchinskiy wrote: In fact, the only safe-ish use for it I have found is to use Storable-related functions in ST, hoping that the instances don't actually use any real IO functionality. Arguably, this

[Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-06 Thread Nicolas Frisby
I haven't been able to find it via Google or Haddock. An old message suggests is was just a matter of exceptions? I only want to use the IO for generating Data.Uniques to pair with STRefs in order to make a map of them. I'm guessing this would be a safe use since it's exception free (... right?).

Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-06 Thread Roman Leshchinskiy
On 07/04/2010, at 07:33, Nicolas Frisby wrote: I haven't been able to find it via Google or Haddock. An old message suggests is was just a matter of exceptions? I don't think that's correct. You can implement unsafePerformIO in terms unsafeIOToST: unsafePerformIO :: IO a - a unsafePerformIO

Re: [Haskell-cafe] what are the safety conditions for unsafeIOToST

2010-04-06 Thread Gregory Crosswhite
I would venture that the condition under which unsafeIOtoST would be safe is if all of the computations you are performing in the IO monad are only changing state that is local to the computation within the ST monad in which you are running. (For example, if there were no STRef type then you