Re: core dumps when making use of IORefs

1999-09-22 Thread Hannah Schroeter
Hello! On Tue, Sep 14, 1999 at 12:43:11AM -0700, Simon Peyton-Jones wrote: {-# notInline test #-} test :: IORef [a] test = unsafePerformIO $ newIORef [] main = do writeIORef test [42] bang - readIORef test print (bang :: [Char]) [...] Hmmm. The type of test should

`forall' subtelties (was: Re: core dumps when making use of IORefs)

1999-09-22 Thread Michael Weber
On Wed, Sep 22, 1999 at 00:36:27 +0200, Hannah Schroeter wrote: On Tue, Sep 14, 1999 at 12:43:11AM -0700, Simon Peyton-Jones wrote: {-# notInline test #-} test :: IORef [a] test = unsafePerformIO $ newIORef [] main = do writeIORef test [42] bang - readIORef test

RE: core dumps when making use of IORefs

1999-09-14 Thread Simon Peyton-Jones
{-# notInline test #-} test :: IORef [a] test = unsafePerformIO $ newIORef [] main = do writeIORef test [42] bang - readIORef test print (bang :: [Char]) This is a very well-known problem in the ML community. In the original monadic I/O paper (POPL'93), Phil and I mentioned

Re: core dumps when making use of IORefs

1999-09-14 Thread John Launchbury
I don't know any way to make unsafePerformIO type-safe without imposing some drastic or complicated restriction. Something in the back of my mind tells me that John Launchbury has another example of type unsafety induced by unsafePerformIO but I can't remember what; so I'm cc'ing him.

RE: core dumps when making use of IORefs

1999-09-13 Thread Simon Marlow
\begin{code} {-# OPTIONS -fglasgow-exts #-} import IO import IOExts {-# notInline test #-} test :: IORef [a] test = unsafePerformIO $ newIORef [] main = do writeIORef test [42] bang - readIORef test print (bang :: [Char]) \end{code} The problem cause is clear, but