FixIO/ Tackling Awkward Squad

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
16 Feb 2001 16:48:24 GMT


Fri, 16 Feb 2001 04:14:26 -0800, Simon Peyton-Jones <simonpj@microsoft.com> pisze:

> fixIO m = do { v <- newEmptyMVar
> 		 ; result <- m (unsafePerformIO (takeMVar v))
> 		 ; putMVar v result
> 		 ; return result }

If we have unsafePerformIO, why not this?

fixIO m = let x = unsafePerformIO (m x) in return $! x

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK