[Haskell-cafe] Re: [Haskell] Top Level <-

Adrian Hey ahey at iee.org
Wed Aug 27 07:56:22 EDT 2008


Ashley Yakeley wrote:
> Adrian Hey wrote:
>> Maybe it would be safest to just say anything with a finaliser can't be
>> created at the top level.
> 
> Do you have an example of something that is correctly ACIO to create, 
> but has a problematic finaliser?

Sorry for the delay in getting my attention. I've been looking at
my old ACIO code (which I've largely forgotten the details
of) and dug up the following snippet.

  -- * Weak pointers
  -- | All these functions require that finalisers (if any) are in the
  -- ACIO Monad.
  -- I'm not sure what such a finaliser can usefully do, but it can't be
  -- in the IO Monad and preserve ACIO Monad properties AFAICS.
  mkWeak,mkWeakPtr,mkWeakPair,addFinalizer,mkWeakIORef,

I must admit I can't remember much about any of this, I just worked
my way through the IO libs trying to figure out which actions might
plausibly (if not usefully :-) be regarded as ACIO. There seemed to be
quite a lot at the end of the day.

I also added a few forkIO variants which force the forked thread
to block on certain things (empty MVar,Chan, QSem..) waiting for
some IO monad action to kick them into life.

Regards
--
Adrian Hey



More information about the Haskell-Cafe mailing list