FixIO/ Tackling Awkward Squad

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
16 Feb 2001 18:27:19 GMT


Fri, 16 Feb 2001 10:01:06 -0800, Levent Erkok <erkok@cse.ogi.edu> pisze:

> The non-strict version is not good either, because it won't do
> the effects!

data Box a = Box {unbox :: a}

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

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