digestive-functors-aeson 1.1 → 1.1.2
raw patch · 3 files changed
+11/−4 lines, 3 files
Files
- digestive-functors-aeson.cabal +1/−1
- src/Text/Digestive/Aeson.hs +1/−3
- test/Tests.hs +9/−0
digestive-functors-aeson.cabal view
@@ -1,6 +1,6 @@ name: digestive-functors-aeson category: Web, JSON-version: 1.1+version: 1.1.2 license: GPL-3 license-file: LICENSE author: Oliver Charles
src/Text/Digestive/Aeson.hs view
@@ -81,8 +81,6 @@ -> (Maybe Value -> f (Maybe Value)) -> Maybe Value -> f (Maybe Value)-pathToLens [p] = key p-pathToLens ps = let ps' = filter (not . T.null) ps- in key (head ps') . (foldl (.) id . map pathElem $ tail ps')+pathToLens = foldl (.) id . map pathElem . filter (not . T.null) where pathElem p = maybe (key p) nth (readMay $ T.unpack p)
test/Tests.hs view
@@ -101,8 +101,17 @@ --------------------------------------------------------------------------------+testTopLevelLists :: Test+testTopLevelLists = testCase "Top level lists" $ do+ let (Just json) = decode "[\"hello\", \"world\"]"+ (runIdentity $ snd <$> digestJSON (listOf text Nothing) json)+ @?= Just [ "hello", "world" ]+++-------------------------------------------------------------------------------- main :: IO () main = defaultMain [ testPokemon , testPokedex+ , testTopLevelLists ]