Per Larsson <[EMAIL PROTECTED]> wrote: > I often use local loops in monadic code, e.g. > > main = do > ... > let loop = do > ... > if cond then loop else return () > loop > > It seems that I can encode this idiom slightly more concise with the 'fix' > operator (from Control.Monad.Fix), i.e. > > main = do > ... > fix (\loop -> do > ... > if ...) > > But is it really semantically equivalent? Is it as efficient? > > Per
It is semantically equivalent. I don't know if it is as efficient; looking at the source code, I would expect GHC to inline fix anywhere it occurs, which yields your original version. Jonathan Cast _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
