packages feed

btree 0.3 → 0.3.1

raw patch · 2 files changed

+13/−4 lines, 2 filesdep ~basedep ~primitivenew-uploader

Dependency ranges changed: base, primitive

Files

btree.cabal view
@@ -1,5 +1,5 @@ name: btree-version: 0.3+version: 0.3.1 synopsis: B-Tree on Unmanaged Heap -- description: homepage: https://github.com/andrewthad/btree@@ -22,9 +22,9 @@     BTree.Linear     ArrayList   build-depends:-      base >= 4.9 && < 4.11+      base >= 4.9 && < 5     , ghc-prim >= 0.5 && < 0.6-    , primitive >= 0.6.1 && < 0.7+    , primitive >= 0.6.4 && < 0.7   default-language: Haskell2010  test-suite test
test/Spec.hs view
@@ -37,6 +37,7 @@ import Control.Monad.Random.Strict hiding (fromList) import Data.Bifunctor import GHC.Exts (fromList)+import Control.Monad.ST (ST, runST)  import qualified Data.List as L import qualified Data.List.NonEmpty as NE@@ -47,6 +48,14 @@ import qualified Data.Set as S import qualified Data.Primitive.PrimArray as P +singletonPrimArray :: forall a. Prim a => a -> P.PrimArray a+singletonPrimArray x = runST sing where+  sing :: forall s. ST s (P.PrimArray a)+  sing = do+    arr <- P.newPrimArray 1+    P.writePrimArray arr 0 x+    P.unsafeFreezePrimArray arr+ main :: IO () main = do   putStrLn "Starting test suite"@@ -173,7 +182,7 @@ arrayListInsertArray :: forall a. (Hashable a, Eq a, Show a, Prim a, Storable a)   => [a] -> Either String String arrayListInsertArray xs = unsafePerformIO $ AL.with $ \a0 -> do-  a1 <- foldlM AL.pushArrayR a0 (map P.singletonPrimArray xs)+  a1 <- foldlM AL.pushArrayR a0 (map singletonPrimArray xs)   let go :: AL.ArrayList a -> IO (AL.ArrayList a, [a])       go al = do         (al',m) <- AL.popL al