diff options
Diffstat (limited to 'Presence/NestingXML.hs')
-rw-r--r-- | Presence/NestingXML.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Presence/NestingXML.hs b/Presence/NestingXML.hs index bf12c9ae..c26e3d5c 100644 --- a/Presence/NestingXML.hs +++ b/Presence/NestingXML.hs | |||
@@ -79,6 +79,16 @@ awaitCloser lvl = do | |||
79 | withXML $ \xml -> do | 79 | withXML $ \xml -> do |
80 | loop | 80 | loop |
81 | 81 | ||
82 | doUntilCloser :: Monad m | ||
83 | => Int -> (Event -> NestingXML o m ()) -> NestingXML o m () | ||
84 | doUntilCloser lvl thunk = do | ||
85 | fix $ \loop -> do | ||
86 | lvl' <- nesting | ||
87 | when (lvl' >= lvl) $ do | ||
88 | withXML $ \xml -> do | ||
89 | thunk xml | ||
90 | loop | ||
91 | |||
82 | nextElement :: Monad m => NestingXML o m (Maybe Event) | 92 | nextElement :: Monad m => NestingXML o m (Maybe Event) |
83 | nextElement = do | 93 | nextElement = do |
84 | lvl <- nesting | 94 | lvl <- nesting |