packages feed

sized-vector 1.3.1.1 → 1.4.0.0

raw patch · 4 files changed

+34/−50 lines, 4 filesdep −criteriondep −paralleldep −progressiondep ~basedep ~deepseqdep ~equational-reasoning

Dependencies removed: criterion, parallel, progression, sized-vector

Dependency ranges changed: base, deepseq, equational-reasoning, hashable, singletons, type-natural

Files

Data/Vector/Sized.hs view
@@ -83,7 +83,7 @@ replicate (SS n) a = a :- replicate n a  -- | 'replicate', with the length inferred.-replicate' :: forall n a. SingRep n => a -> Vector a n+replicate' :: forall n a. SingI n => a -> Vector a n replicate' = replicate (sing :: SNat n)  -- | Construct a singleton vector.@@ -107,11 +107,11 @@ unsafeFromList len = fromMaybe (error "Length too short") . fromList len  -- | Convert a list into vector, with length inferred.-fromList' :: SingRep n => [a] -> Maybe (Vector a n)+fromList' :: SingI n => [a] -> Maybe (Vector a n) fromList' = fromList sing  -- | Unsafe version of 'unsafeFromList'.-unsafeFromList' :: SingRep n => [a] -> Vector a n+unsafeFromList' :: SingI n => [a] -> Vector a n unsafeFromList' = unsafeFromList sing  -- | Convert a vector into a list.@@ -140,6 +140,13 @@ tail :: Vector a (S n) -> Vector a n tail (_ :- xs) = xs +-- | Extract the elements before the last of a non-empty list.+init :: Vector a (S n) -> Vector a n+init (a :- as) =+  case as of+    Nil    -> Nil+    _ :- _ -> a :- init as+ -- | Test whether a @Vector@ is empty, though it's clear from the type parameter. null :: Vector a n -> Bool null Nil = True@@ -184,7 +191,7 @@   x :- (coerce (plusSR (sLength xs) (sLength xs)) $ a :- prependToAll a xs)  -- | The 'transpose' function transposes the rows and columns of its argument.-transpose :: SingRep n => Vector (Vector a n) m -> Vector (Vector a m) n+transpose :: SingI n => Vector (Vector a n) m -> Vector (Vector a m) n transpose Nil = replicate' Nil transpose (Nil :- _) = Nil transpose ((x :- xs) :- xss) =@@ -420,7 +427,7 @@ rnfVector (x :- xs) = rnf x `seq` rnf xs `seq` ()  vecHashWithSalt :: Hashable a => Int -> Vector a n -> Int-vecHashWithSalt salt Nil = salt `combine` 0+vecHashWithSalt salt Nil = salt `hashWithSalt` (0 :: Int) vecHashWithSalt salt xs  = foldl hashWithSalt salt xs  instance Hashable a => Hashable (Vector a n) where
README.md view
@@ -1,4 +1,5 @@ Type-level sized vector library ================================+[![Build Status](https://travis-ci.org/konn/sized-vector.svg)](https://travis-ci.org/konn/sized-vector)  
− bench/coercion.hs
@@ -1,29 +0,0 @@-{-# LANGUAGE QuasiQuotes #-}-module Main where-import           Control.DeepSeq-import           Control.Parallel.Strategies-import           Criterion-import           Data.Type.Natural-import qualified Data.Vector.Sized           as V-import           Progression.Main-import           System.Environment--main :: IO ()-main = do-  name : rest <- getArgs-  v10 <- return $!! ((V.replicate [snat|10|] ()) `using` rdeepseq)-  v100 <- return $!! ((V.replicate [snat|100|] ()) `using` rdeepseq)-  v200 <- return $!! ((V.replicate [snat|200|] ()) `using` rdeepseq)-  withArgs (("-n"++name) : rest) $-    defaultMain $-    bgroup "bench" [ bgroup "reverse"-                     [ bench "10" $ nf V.reverse v10-                     , bench "100" $ nf V.reverse v100-                     , bench "1000" $ nf V.reverse v200-                     ]-                   , bgroup "intersperse"-                     [ bench "10" $ nf (V.intersperse ()) v10-                     , bench "100" $ nf (V.intersperse ()) v100-                     , bench "200" $ nf (V.intersperse ()) v200-                     ]-                   ]
sized-vector.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                sized-vector-version:             1.3.1.1+version:             1.4.0.0 synopsis:            Size-parameterized vector types and functions. description:         Size-parameterized vector types and functions using a data-type promotion. homepage:            https://github.com/konn/sized-vector@@ -22,23 +22,28 @@ library   exposed-modules:     Data.Vector.Sized   build-depends:       base                     >= 2.0          && < 5-               ,       singletons               == 0.8.*                ,       type-natural             >= 0.1          && < 0.3                ,       constraints                ,       monomorphic              == 0.0.*-               ,       equational-reasoning     >= 0.0.3        && < 0.1-               ,       hashable                 == 1.1.*+               ,       equational-reasoning     >= 0.2          && < 0.3+               ,       hashable                 >= 1.1          && < 1.3                ,       deepseq                  == 1.3.*+  if impl(ghc < 7.7)+    build-depends:     singletons               == 0.8.*+  if impl(ghc >= 7.7)+    build-depends:     singletons               == 0.10.* -Benchmark coercion-bench-  type:                 exitcode-stdio-1.0-  main-is:              coercion.hs-  hs-source-dirs:       bench-  ghc-options:          -O2 -threaded -fcontext-stack=500-  build-depends:        criterion-               ,        progression-               ,        sized-vector-               ,        base-               ,        type-natural-               ,        parallel-               ,        deepseq+-- Benchmark coercion-bench+--   buildable:            False+--   type:                 exitcode-stdio-1.0+--   main-is:              coercion.hs+--   hs-source-dirs:       bench+--   ghc-options:          -O2 -threaded -fcontext-stack=500+--   build-depends:        criterion+--                ,        statistics   >=0.10 && < 0.11+--                ,        progression+--                ,        sized-vector+--                ,        base+--                ,        type-natural+--                ,        parallel+--                ,        deepseq