ST and IO. Two problems. Some old some new?

Ross Paterson ross@soi.city.ac.uk
Thu, 7 Feb 2002 11:54:01 +0000


On Thu, Feb 07, 2002 at 12:41:50PM +0100, Koen Claessen wrote:
> Amr Sabry wrote:
>  | 2. Soundness of stToIO
>  :
>  | data Var a = Var { get :: () -> IO a,
>  |                    set :: a -> IO ()}
> 
> (Why does get have this type?)
> 
> [...]
> 
> The type of stToIO is:
> 
>   stToIO :: ST RealWorld a -> IO a

This was discussed in glasgow-haskell-bugs in Oct 2000.  GHC does indeed
use a sound type, but it is documented as the unsound

	StTOIO :: ST s a -> IO a

and that is the type that Hugs uses.  (Call it IORegion instead of
RealWorld if you like.)