diff options
Diffstat (limited to 'Presence/Nesting.hs')
-rw-r--r-- | Presence/Nesting.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Presence/Nesting.hs b/Presence/Nesting.hs index dd0e4113..720237fd 100644 --- a/Presence/Nesting.hs +++ b/Presence/Nesting.hs | |||
@@ -6,7 +6,7 @@ import Data.Conduit | |||
6 | import Data.Conduit.Lift | 6 | import Data.Conduit.Lift |
7 | import Data.XML.Types | 7 | import Data.XML.Types |
8 | import qualified Data.Text as S | 8 | import qualified Data.Text as S |
9 | import Control.Monad.State | 9 | import Control.Monad.State.Strict |
10 | import qualified Data.List as List | 10 | import qualified Data.List as List |
11 | 11 | ||
12 | type Lang = S.Text | 12 | type Lang = S.Text |
@@ -30,11 +30,10 @@ nesting = lift $ (return . nestingLevel) =<< get | |||
30 | xmlLang :: Monad m => NestingXML o m (Maybe Lang) | 30 | xmlLang :: Monad m => NestingXML o m (Maybe Lang) |
31 | xmlLang = fmap (fmap snd . top . langStack) (lift get) | 31 | xmlLang = fmap (fmap snd . top . langStack) (lift get) |
32 | where | 32 | where |
33 | top ( a :! as ) = Just a | 33 | top ( a :! _as ) = Just a |
34 | top _ = Nothing | 34 | top _ = Nothing |
35 | 35 | ||
36 | 36 | trackNesting :: Monad m => Conduit Event (StateT XMLState m) Event | |
37 | trackNesting :: Monad m => ConduitM Event Event (StateT XMLState m) () | ||
38 | trackNesting = awaitForever doit | 37 | trackNesting = awaitForever doit |
39 | where | 38 | where |
40 | doit xml = do | 39 | doit xml = do |
@@ -61,7 +60,7 @@ lookupLang attrs = | |||
61 | 60 | ||
62 | 61 | ||
63 | awaitCloser :: Monad m => Int -> NestingXML o m () | 62 | awaitCloser :: Monad m => Int -> NestingXML o m () |
64 | awaitCloser lvl = do | 63 | awaitCloser lvl = |
65 | fix $ \loop -> do | 64 | fix $ \loop -> do |
66 | lvl' <- nesting | 65 | lvl' <- nesting |
67 | when (lvl' >= lvl) $ do | 66 | when (lvl' >= lvl) $ do |
@@ -80,8 +79,7 @@ nextElement = do | |||
80 | xml <- await | 79 | xml <- await |
81 | case xml of | 80 | case xml of |
82 | Nothing -> return Nothing | 81 | Nothing -> return Nothing |
83 | Just (EventBeginElement _ _) -> do | 82 | Just (EventBeginElement _ _) -> return xml |
84 | return xml | ||
85 | Just _ -> do | 83 | Just _ -> do |
86 | lvl' <- nesting | 84 | lvl' <- nesting |
87 | if (lvl'>=lvl) then loop | 85 | if (lvl'>=lvl) then loop |