From fc3205a346082d1e7e416a2570ab62afdc393e89 Mon Sep 17 00:00:00 2001 From: David Mosbach Date: Sun, 27 Aug 2023 05:15:35 +0200 Subject: [PATCH] fixed assoc list resolution bug --- app/YamlParser.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/YamlParser.hs b/app/YamlParser.hs index db7513d..699f1ae 100644 --- a/app/YamlParser.hs +++ b/app/YamlParser.hs @@ -223,9 +223,9 @@ module YamlParser where (<|) :: FromYAML' a => [(YAMLNode, YAMLNode)] -> Text -> Parser a mapping <| key = maybe (fail $ "key " ++ show key ++ " not found") fromYAML (P.lookup key $ prep mapping) where prep :: [(YAMLNode, YAMLNode)] -> [(Text, YAMLNode)] - prep mapping = [(decodeUtf8 scalar.bytes, val) | (scalar, val) <- mapping] + prep mapping = reverse [(decodeUtf8 scalar.bytes, val) | (scalar, val) <- mapping] (<|?) :: FromYAML' a => [(YAMLNode, YAMLNode)] -> Text -> Parser (Maybe a) mapping <|? key = maybe (pure Nothing) fromYAML (P.lookup key $ prep mapping) where prep :: [(YAMLNode, YAMLNode)] -> [(Text, YAMLNode)] - prep mapping = [(decodeUtf8 scalar.bytes, val) | (scalar, val) <- mapping] \ No newline at end of file + prep mapping = reverse [(decodeUtf8 scalar.bytes, val) | (scalar, val) <- mapping] \ No newline at end of file