tries 0.0.6 → 0.0.6.1
raw patch · 6 files changed
+12/−22 lines, 6 files
Files
- LICENSE +1/−1
- README.md +1/−1
- src/Data/Trie/HashMap.hs +1/−3
- src/Data/Trie/Map.hs +1/−9
- src/Data/Trie/Pseudo.hs +2/−2
- tries.cabal +6/−6
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2015, Athan Clark+Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020 Athan Clark All rights reserved.
README.md view
@@ -29,5 +29,5 @@ for lookups: ```bash-stack bench --benchmark-arguments="--output profile-lookup.html" --flag tries:Lookup+stack bench --benchmark-arguments="--output profile-lookup.html" tries:bench:tries-bench-lookup ```
src/Data/Trie/HashMap.hs view
@@ -153,9 +153,7 @@ } deriving (Show, Eq, Functor, Foldable, Traversable, Semigroup, Monoid, Arbitrary) -instance ( Hashable p- , Eq p- ) => Trie NonEmpty p HashMapTrie where+instance (Hashable p, Eq p) => Trie NonEmpty p HashMapTrie where lookup ts (HashMapTrie xs) = lookup ts xs delete ts (HashMapTrie xs) = HashMapTrie (delete ts xs) insert ts x (HashMapTrie xs) = HashMapTrie (Data.Trie.HashMap.insert ts x xs)
src/Data/Trie/Map.hs view
@@ -29,15 +29,12 @@ import Data.Semigroup (Semigroup) import Data.Monoid (First (..), Last (..), (<>)) import Control.Monad (replicateM)- import Data.Data (Data, Typeable) import GHC.Generics (Generic) import Control.DeepSeq (NFData) import Test.QuickCheck (Arbitrary (..), resize, choose, sized, scale) import Test.QuickCheck.Instances () -- -- * One Step data MapChildren c p a = MapChildren@@ -66,7 +63,6 @@ ) => Monoid (MapChildren c p a) where mempty = MapChildren Nothing Nothing - newtype MapStep c p a = MapStep { unMapStep :: Map.Map p (MapChildren c p a) } deriving (Show, Eq, Ord, Functor, Foldable, Traversable, Generic, Data, Typeable)@@ -91,9 +87,7 @@ -- | No insertion instance - requires children nodes to be a monoid. Use @Data.Trie.Map.insert@ -- instead.-instance ( Ord p- , Trie NonEmpty p c- ) => Trie NonEmpty p (MapStep c) where+instance (Ord p, Trie NonEmpty p c) => Trie NonEmpty p (MapStep c) where lookup (p:|ps) (MapStep xs) | F.null ps = mapNode =<< Map.lookup p xs | otherwise = lookup (NE.fromList ps) =<< mapChildren =<< Map.lookup p xs@@ -103,7 +97,6 @@ | otherwise = let (MapChildren mx mxs) = fromMaybe (MapChildren Nothing Nothing) (Map.lookup p xs) in MapStep (Map.insert p (MapChildren mx (delete (NE.fromList ps) <$> mxs)) xs) - insert :: ( Ord p , Trie NonEmpty p c , Monoid (c p a)@@ -122,7 +115,6 @@ ) => Semigroup (MapStep c s a) where (MapStep xs) <> (MapStep ys) = MapStep (Map.unionWith (<>) xs ys)- instance ( Ord s , Monoid (c s a)
src/Data/Trie/Pseudo.hs view
@@ -23,11 +23,11 @@ | Nil deriving (Show, Eq, Functor, Foldable, Traversable) +-- | Overwriting instance instance Eq t => Semigroup (PseudoTrie t a) where (<>) = merge --- | Overwriting instance-instance (Eq t) => Monoid (PseudoTrie t a) where+instance Eq t => Monoid (PseudoTrie t a) where mempty = Nil beginsWith :: (Eq t) => PseudoTrie t a -> t -> Bool
tries.cabal view
@@ -1,21 +1,21 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.0.+-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack ----- hash: b5b8b6262290f4b3819cf5059836cf61223454ee5d3f4ccebf373af29b582f66+-- hash: 28fc0214548e9c3bb27473bb46c6076b6435d31256fe34fc845077e5fba6faae name: tries-version: 0.0.6+version: 0.0.6.1 synopsis: Various trie implementations in Haskell-description: Please see the README on Github at <https://git.localcooking.com/tooling/tries#readme>+description: Please see the README on Github at <https://github.com/athanclark/tries#readme> category: Data, Tree homepage: https://github.com/athanclark/tries#readme bug-reports: https://github.com/athanclark/tries/issues author: Athan Clark-maintainer: athan.clark@localcooking.com-copyright: 2018 Athan Clark+maintainer: athan.clark@gmail.com+copyright: 2015, 2016, 2017, 2018, 2019, 2020 Athan Clark license: BSD3 license-file: LICENSE build-type: Simple