Why not have
    fix :: (a -> a) -> a
    fix f = f (fix f)
in the Prelude?

It's nicer to write
    someFunction arg = do
        x <- prepare arg
        fix $ \loop -> do
            workOn x
            cond <- test x
            if cond then return x else loop
than
    someFunction arg = do
        x <- prepare arg
        let loop = do
                workOn x
                cond <- test x
                if cond then return x else loop
        loop
and I don't like maintaining a bunch of those little utilities used in
many modules :-)

The name fix is consistent with naming of GHC and Hugs extensions:
fixIO, fixST, mfix. They are monadic variants; where is the basic
simple fix?!

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a23 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-


Reply via email to