Suggestion:

add another form of statement for monad expressions:

stmts -> ...
         if exp

which is defined for MonadZero as follows:

        do {if exp ; stmts} = if exp then do {stmts}
                              else zero

Based on this, one can define list comprehensions by

        [ e | q1,...,qn ] = do { q1' ; ... ; qn'; return e }

where either  qi' = if qi  (whenever qi is an exp)
or  qi' = qi  (otherwise).

--
Stefan Kahrs



Reply via email to