From af97598954f07c9762208ef16b03b86494d6b21e Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 28 Oct 2021 10:31:04 +0200 Subject: Lua: increase strictness when getting attribute keys --- src/Text/Pandoc/Lua/Marshaling/Attr.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Lua') diff --git a/src/Text/Pandoc/Lua/Marshaling/Attr.hs b/src/Text/Pandoc/Lua/Marshaling/Attr.hs index f69acc61e..2f1f2406a 100644 --- a/src/Text/Pandoc/Lua/Marshaling/Attr.hs +++ b/src/Text/Pandoc/Lua/Marshaling/Attr.hs @@ -71,7 +71,7 @@ peekAttribs idx = liftLua (ltype idx) >>= \case TypeTable -> liftLua (rawlen idx) >>= \case 0 -> peekKeyValuePairs peekText peekText idx _ -> peekList (peekPair peekText peekText) idx - _ -> fail "unsupported type" + _ -> failPeek "unsupported type" pushAttribs :: LuaError e => Pusher e [(Text, Text)] pushAttribs = pushUD typeAttributeList @@ -139,7 +139,7 @@ peekAttribute idx = (AttributeValue <$!> peekText idx) lookupKey :: [(Text,Text)] -> Maybe Key -> Maybe Attribute lookupKey !kvs = \case - Just (StringKey str) -> AttributeValue <$> lookup str kvs + Just (StringKey str) -> AttributeValue <$!> lookup str kvs Just (IntKey n) -> AttributePair <$!> atMay kvs (n - 1) Nothing -> Nothing -- cgit v1.2.3