@@ -52,7 +52,7 @@ import Data.Monoid (First(..), getFirst)
52
52
import Data.List (transpose )
53
53
import Control.Applicative ((<|>) )
54
54
import qualified Data.Text as T
55
- import Control.Monad (filterM , guard )
55
+ import Control.Monad (filterM , mzero )
56
56
import Control.Monad.Reader (ReaderT , runReaderT , asks , local )
57
57
import Data.Either (rights )
58
58
@@ -449,14 +449,14 @@ underover e = do
449
449
-- Other
450
450
451
451
semantics :: Element -> MML Exp
452
- semantics e = do
453
- guard ( not $ null cs)
454
- first <- safeExpr ( head cs)
455
- if isEmpty first
456
- then fromMaybe empty . getFirst . mconcat <$> mapM annotation ( tail cs)
457
- else return first
458
- where
459
- cs = elChildren e
452
+ semantics e =
453
+ case elChildren e of
454
+ [] -> mzero
455
+ (c : cs) -> do
456
+ first <- safeExpr c
457
+ if isEmpty first
458
+ then fromMaybe empty . getFirst . mconcat <$> mapM annotation cs
459
+ else return first
460
460
461
461
annotation :: Element -> MML (First Exp )
462
462
annotation e = do
@@ -509,7 +509,7 @@ tableRow a e = do
509
509
align <- maybe a toAlignment <$> (findAttrQ " columnalign" e)
510
510
case name e of
511
511
" mtr" -> mapM (tableCell align) (elChildren e)
512
- " mlabeledtr" -> mapM (tableCell align) (tail $ elChildren e)
512
+ " mlabeledtr" -> mapM (tableCell align) (drop 1 $ elChildren e)
513
513
_ -> throwError $ " Invalid Element: Only expecting mtr elements " <> err e
514
514
515
515
tableCell :: Alignment -> Element -> MML (Alignment , [Exp ])
0 commit comments