mirror of
https://github.com/github/semantic.git
synced 2025-01-01 19:55:34 +03:00
Use while
to define forLoop
.
This commit is contained in:
parent
eb364317cb
commit
1e1495a507
@ -86,12 +86,7 @@ forLoop :: MonadValue term value m
|
|||||||
forLoop initial cond step body = do
|
forLoop initial cond step body = do
|
||||||
void initial
|
void initial
|
||||||
env <- getGlobalEnv
|
env <- getGlobalEnv
|
||||||
localEnv (mappend env) (fix $ \ loop -> do
|
localEnv (mappend env) (while cond (body *> step))
|
||||||
cond' <- cond
|
|
||||||
ifthenelse cond' (do
|
|
||||||
void body
|
|
||||||
void step
|
|
||||||
loop) unit)
|
|
||||||
|
|
||||||
-- | The fundamental looping primitive, built on top of ifthenelse.
|
-- | The fundamental looping primitive, built on top of ifthenelse.
|
||||||
while :: MonadValue term value m => m value -> m value -> m value
|
while :: MonadValue term value m => m value -> m value -> m value
|
||||||
|
Loading…
Reference in New Issue
Block a user