Rekursion (semantisch)

bisher:

fix :: ( a -> a ) -> a
fix f = f ( fix f )
jetzt:
import Control.Monad.Fix
class MonadFix m where
    mfix :: ( a -> m a ) -> m a

instance MonadFix Action where
mfix f = Action $ \ s0 -> 
    let Action a = f v
        ( s1, v ) = a s0
    in  ( s1, v )



Johannes Waldmann 2012-01-30