On Thu, Oct 08, 2009 at 12:54:14AM -0700, o...@okmij.org wrote: > Actually it is possible to implement all three evaluation orders > within the same final tagless framework, using the same interpretation > of types and reusing most of the code save the semantics of lam. That > is where the three orders differ, by their own definition.
That's really nice, Oleg, thanks! I just wanted to comment that I'd prefer to write share :: IO a -> IO (IO a) share m = mdo r <- newIORef (do x <- m writeIORef r (return x) return x) return (readIORef r >>= id) which unfortunately needs {-# LANGUAGE RecursiveDo #-} or some ugliness from mfix share :: IO a -> IO (IO a) share m = do r <- mfix $ \r -> newIORef (do x <- m writeIORef r (return x) return x) return (readIORef r >>= id) Thanks, -- Felipe. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe