pred-trie 0.2.3 → 0.2.4
raw patch · 2 files changed
+7/−9 lines, 2 filesdep ~composition-extra
Dependency ranges changed: composition-extra
Files
pred-trie.cabal view
@@ -1,5 +1,5 @@ Name: pred-trie-Version: 0.2.3+Version: 0.2.4 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: BSD3
src/Data/Trie/Pred/Unified/Tail.hs view
@@ -205,21 +205,19 @@ -- | Return all nodes passed during a lookup lookupThrough :: Eq t => Path t -> UPTrie t x -> [x]-lookupThrough (t:|ts) (UMore t' mx xs)- | null ts = maybeToList $ do guard (t == t')- mx- | otherwise = maybeToList mx- ++ (do guard (t == t')- firstNonEmpty $ lookupThrough (NE.fromList ts) <$> xs)+lookupThrough (t:|ts) (UMore t' mx xs) = do+ guard $ t == t'+ maybeToList mx ++ (do guard $ null ts+ firstNonEmpty $ fmap (lookupThrough $ NE.fromList ts) xs) lookupThrough (t:|ts) (UPred _ p mrx xrs) =- let (l,r) = fromMaybe (Nothing,[]) $ do+ let (left,right) = fromMaybe (Nothing,[]) $ do r <- p t return $ if null ts then ( mrx <~$> r, []) else ( mrx <~$> r , firstNonEmpty (fmap (lookupThrough $ NE.fromList ts) xrs) <~$> r )- in maybeToList l ++ r+ in maybeToList left ++ right firstNonEmpty :: [[a]] -> [a] firstNonEmpty [] = []