ralist 0.3.0.0 → 0.4.0.0
raw patch · 4 files changed
+11/−13 lines, 4 filesdep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: transformers
API changes (from Hackage documentation)
- Data.RAList.Co: lookup :: forall a. Word64 -> RAList a -> Maybe a
+ Data.RAList.Co: lookup :: forall a. RAList a -> Word64 -> Maybe a
Files
- changelog.md +5/−0
- ralist.cabal +1/−1
- src/Data/RAList.hs +3/−10
- src/Data/RAList/Co.hs +2/−2
changelog.md view
@@ -1,3 +1,8 @@+# 0.4.0.0++* flipped the argument order for `Co.lookup` to be consistent between+both flavors of RAList apis+ # 0.3.0.0 * changed type from `lookupM :: forall (m :: * -> *) a. Monad m => Word64 -> Top a -> m a` to `lookupM :: forall a. Word64 -> Top a -> Either String a`
ralist.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 Name: ralist-Version: 0.3.0.0+Version: 0.4.0.0 License: BSD-3-Clause license-file: LICENSE Author: Lennart Augustsson, Carter Schonwald
src/Data/RAList.hs view
@@ -418,6 +418,8 @@ instance FoldableWithIndex Word64 RAList where instance FunctorWithIndex Word64 RAList where +-- TODO: look into ways to make the toList more efficient if needed+ instance Foldable RAList where {-# INLINE null#-} null = \ x -> case x of Nil -> True ; _ -> False@@ -931,17 +933,8 @@ | otherwise = Node x l (adjt (j-1-w) (w `quot` 2) r) adjt _ _ _ = error "Data.RAList.adjust: impossible" --- XXX Make this a good producer--- | Complexity /O(n)/.---toList :: RAList a -> [a]---toList = foldr (:) []---toList ra = tops ra []--- where flat (Leaf x) a = x : a--- flat (Node x l r) a = x : flat l (flat r a)--- tops RNil r = r--- tops (RCons _tot _ t xs) r = flat t (tops xs r) --- XXX Use number system properties to make this more efficient.+ -- | Complexity /O(n)/. fromList :: [a] -> RAList a fromList = Prelude.foldr Cons Nil
src/Data/RAList/Co.hs view
@@ -333,8 +333,8 @@ lookupM = \ ix tree -> QRA.lookupM (reindex tree) ((wLength tree) - ix) {-# INLINE lookup #-}-lookup :: forall a. Word64 -> RAList a -> Maybe a-lookup = \ ix tree -> QRA.lookup (reindex tree) ((wLength tree) - ix )+lookup :: forall a. RAList a -> Word64 -> Maybe a+lookup = \ (CoIndex tree) ix -> QRA.lookup tree ((QRA.wLength tree) - ix ) {-# INLINE lookupCC #-} lookupCC :: RAList a -> Word64 -> (a -> r) -> (String -> r) -> r