Anonymous user
Loops/While: Difference between revisions
m
→{{header|Haskell}}
(→{{header|Haskell}}: add monadic implementation) |
|||
Line 207:
<lang haskell>import Control.Monad (when)
whileM :: (Monad m) => m Bool -> m
whileM cond body = do c <- cond
when c (body >> whileM cond body)</lang>
|