hw-prim (empty) → 0.0.0.2
raw patch · 16 files changed
+620/−0 lines, 16 filesdep +QuickCheckdep +basedep +bytestringsetup-changed
Dependencies added: QuickCheck, base, bytestring, criterion, hspec, hw-prim, random, vector
Files
- LICENSE +30/−0
- README.md +3/−0
- Setup.hs +2/−0
- app/Main.hs +4/−0
- bench/Main.hs +16/−0
- hw-prim.cabal +67/−0
- src/HaskellWorks/Data/ByteString.hs +12/−0
- src/HaskellWorks/Data/FromByteString.hs +10/−0
- src/HaskellWorks/Data/FromForeignRegion.hs +9/−0
- src/HaskellWorks/Data/Positioning.hs +39/−0
- src/HaskellWorks/Data/Search.hs +14/−0
- src/HaskellWorks/Data/Vector/BoxedVectorLike.hs +57/−0
- src/HaskellWorks/Data/Vector/StorableVectorLike.hs +57/−0
- src/HaskellWorks/Data/Vector/VectorLike.hs +288/−0
- test/HaskellWorks/Data/SearchSpec.hs +11/−0
- test/Spec.hs +1/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright John Ky (c) 2016++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Author name here nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,3 @@+# hw-prim+[](https://circleci.com/gh/haskell-works/hw-prim/tree/master)+Primitive types library.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ app/Main.hs view
@@ -0,0 +1,4 @@+module Main where++main :: IO ()+main = print "Hello world"
+ bench/Main.hs view
@@ -0,0 +1,16 @@+module Main where++import Criterion.Main+import qualified Data.Vector.Storable as DVS+import Data.Word++setupEnvVector :: Int -> IO (DVS.Vector Word64)+setupEnvVector n = return $ DVS.fromList (take n (cycle [maxBound, 0]))++benchPopCount1 :: [Benchmark]+benchPopCount1 =+ [+ ]++main :: IO ()+main = defaultMain benchPopCount1
+ hw-prim.cabal view
@@ -0,0 +1,67 @@+name: hw-prim+version: 0.0.0.2+synopsis: Primitive functions and data types+description: Please see README.md+homepage: http://github.com/haskell-works/hw-prim#readme+license: BSD3+license-file: LICENSE+author: John Ky+maintainer: newhoggy@gmail.com+copyright: 2016 John Ky+category: Data+stability: Experimental+build-type: Simple+extra-source-files: README.md+cabal-version: >= 1.10++executable hw-prim-example+ hs-source-dirs: app+ main-is: Main.hs+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -msse4.2+ build-depends: base >= 4 && < 5+ , hw-prim+ default-language: Haskell2010++library+ hs-source-dirs: src+ exposed-modules: HaskellWorks.Data.ByteString+ , HaskellWorks.Data.FromByteString+ , HaskellWorks.Data.FromForeignRegion+ , HaskellWorks.Data.Positioning+ , HaskellWorks.Data.Search+ , HaskellWorks.Data.Vector.BoxedVectorLike+ , HaskellWorks.Data.Vector.StorableVectorLike+ , HaskellWorks.Data.Vector.VectorLike+ build-depends: base >= 4.7 && < 5+ , vector+ , bytestring+ , random++ default-language: Haskell2010+ ghc-options: -rtsopts -with-rtsopts=-N -Wall -O2 -msse4.2++test-suite hw-prim-test+ type: exitcode-stdio-1.0+ hs-source-dirs: test+ main-is: Spec.hs+ other-modules: HaskellWorks.Data.SearchSpec+ build-depends: base+ , hspec+ , QuickCheck+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall+ default-language: Haskell2010++source-repository head+ type: git+ location: https://github.com/haskell-works/hw-prim++benchmark bench+ Type: exitcode-stdio-1.0+ HS-Source-Dirs: bench+ Main-Is: Main.hs+ GHC-Options: -Wall -O2 -msse4.2+ Default-Language: Haskell2010+ Build-Depends: base >= 4 && < 5+ , criterion+ , hw-prim+ , vector
+ src/HaskellWorks/Data/ByteString.hs view
@@ -0,0 +1,12 @@+module HaskellWorks.Data.ByteString+ ( chunkedBy+ ) where++import qualified Data.ByteString as BS++-- | Chunk a @bs into list of smaller byte strings of no more than @n elements+chunkedBy :: Int -> BS.ByteString -> [BS.ByteString]+chunkedBy n bs = if BS.length bs == 0+ then []+ else case BS.splitAt n bs of+ (as, zs) -> as : chunkedBy n zs
+ src/HaskellWorks/Data/FromByteString.hs view
@@ -0,0 +1,10 @@+module HaskellWorks.Data.FromByteString+ ( FromByteString(..)+ ) where++import Data.ByteString.Internal++-- | Class for byte-string-like datastructures+class FromByteString a where+ -- | Convert a byte string to a value of type @a+ fromByteString :: ByteString -> a
+ src/HaskellWorks/Data/FromForeignRegion.hs view
@@ -0,0 +1,9 @@+module HaskellWorks.Data.FromForeignRegion where++import Data.Word+import Foreign.ForeignPtr++-- | Class for datastructures that can be created from a foreign region+class FromForeignRegion a where+ -- | Create a value of type @a from a foreign region.+ fromForeignRegion :: (ForeignPtr Word8, Int, Int) -> a
+ src/HaskellWorks/Data/Positioning.hs view
@@ -0,0 +1,39 @@+{-# LANGUAGE GeneralizedNewtypeDeriving #-}++module HaskellWorks.Data.Positioning+ ( Count(..)+ , Position(..)+ , lastPositionOf+ , toCount+ , toPosition+ ) where++import Data.Int+import Data.Word+import System.Random++-- | A value representing a count+newtype Count = Count { getCount :: Word64 }+ deriving (Eq, Num, Ord, Enum, Integral, Real, Random)++instance Show Count where+ show (Count w64) = show w64++ -- | A value representing a position+newtype Position = Position { getPosition :: Int64 }+ deriving (Eq, Num, Ord, Enum, Real, Integral)++instance Show Position where+ show (Position n) = show n++-- | Convert a count to a position+toPosition :: Count -> Position+toPosition (Count n) = Position (fromIntegral n)++-- | Convert a count to a count+toCount :: Position -> Count+toCount (Position n) = Count (fromIntegral n)++-- | Get largest position in a sequenced container of size count.+lastPositionOf :: Count -> Position+lastPositionOf (Count c) = Position (fromIntegral c - 1)
+ src/HaskellWorks/Data/Search.hs view
@@ -0,0 +1,14 @@+module HaskellWorks.Data.Search+ ( binarySearch+ ) where++-- | Perform a binary search in the domain of function @f, bounded by the values @p and @q+-- to find the least value @v such that: @w <= (f v)+binarySearch :: (Ord a, Integral n) => a -> (n -> a) -> n -> n -> n+binarySearch w f p q = if p + 1 >= q+ then p+ else let m = p + q `div` 2 in+ if w <= f m+ then binarySearch w f p m+ else binarySearch w f m q+{-# INLINABLE binarySearch #-}
+ src/HaskellWorks/Data/Vector/BoxedVectorLike.hs view
@@ -0,0 +1,57 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}++module HaskellWorks.Data.Vector.BoxedVectorLike+ ( BoxedVectorLike(..)+ ) where++import qualified Data.Vector as DV+import Data.Word+import Foreign.Storable++-- | Class of values that support boxed vector like operations+class BoxedVectorLike v e where+ bImap :: (Int -> a -> b) -> v a -> v b+ bMap :: (a -> b) -> v a -> v b+ bUnfoldr :: (Storable a) => (b -> Maybe (a, b)) -> b -> v a+ bUnfoldrN :: (Storable a) => Int -> (b -> Maybe (a, b)) -> b -> v a++instance BoxedVectorLike DV.Vector Word8 where+ bImap = DV.imap+ bMap = DV.map+ bUnfoldr = DV.unfoldr+ bUnfoldrN = DV.unfoldrN+ {-# INLINE bImap #-}+ {-# INLINE bMap #-}+ {-# INLINE bUnfoldr #-}+ {-# INLINE bUnfoldrN #-}++instance BoxedVectorLike DV.Vector Word16 where+ bImap = DV.imap+ bMap = DV.map+ bUnfoldr = DV.unfoldr+ bUnfoldrN = DV.unfoldrN+ {-# INLINE bImap #-}+ {-# INLINE bMap #-}+ {-# INLINE bUnfoldr #-}+ {-# INLINE bUnfoldrN #-}++instance BoxedVectorLike DV.Vector Word32 where+ bImap = DV.imap+ bMap = DV.map+ bUnfoldr = DV.unfoldr+ bUnfoldrN = DV.unfoldrN+ {-# INLINE bImap #-}+ {-# INLINE bMap #-}+ {-# INLINE bUnfoldr #-}+ {-# INLINE bUnfoldrN #-}++instance BoxedVectorLike DV.Vector Word64 where+ bImap = DV.imap+ bMap = DV.map+ bUnfoldr = DV.unfoldr+ bUnfoldrN = DV.unfoldrN+ {-# INLINE bImap #-}+ {-# INLINE bMap #-}+ {-# INLINE bUnfoldr #-}+ {-# INLINE bUnfoldrN #-}
+ src/HaskellWorks/Data/Vector/StorableVectorLike.hs view
@@ -0,0 +1,57 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}++module HaskellWorks.Data.Vector.StorableVectorLike+ ( StorableVectorLike(..)+ ) where++import qualified Data.Vector.Storable as DVS+import Data.Word+import Foreign.Storable++-- | Class of values that support storable vector like operations+class StorableVectorLike v e where+ sImap :: (Storable a, Storable b) => (Int -> a -> b) -> v a -> v b+ sMap :: (Storable a, Storable b) => (a -> b) -> v a -> v b+ sUnfoldr :: (Storable a) => (b -> Maybe (a, b)) -> b -> v a+ sUnfoldrN :: (Storable a) => Int -> (b -> Maybe (a, b)) -> b -> v a++instance StorableVectorLike DVS.Vector Word8 where+ sImap = DVS.imap+ sMap = DVS.map+ sUnfoldr = DVS.unfoldr+ sUnfoldrN = DVS.unfoldrN+ {-# INLINABLE sImap #-}+ {-# INLINABLE sMap #-}+ {-# INLINABLE sUnfoldr #-}+ {-# INLINABLE sUnfoldrN #-}++instance StorableVectorLike DVS.Vector Word16 where+ sImap = DVS.imap+ sMap = DVS.map+ sUnfoldr = DVS.unfoldr+ sUnfoldrN = DVS.unfoldrN+ {-# INLINABLE sImap #-}+ {-# INLINABLE sMap #-}+ {-# INLINABLE sUnfoldr #-}+ {-# INLINABLE sUnfoldrN #-}++instance StorableVectorLike DVS.Vector Word32 where+ sImap = DVS.imap+ sMap = DVS.map+ sUnfoldr = DVS.unfoldr+ sUnfoldrN = DVS.unfoldrN+ {-# INLINABLE sImap #-}+ {-# INLINABLE sMap #-}+ {-# INLINABLE sUnfoldr #-}+ {-# INLINABLE sUnfoldrN #-}++instance StorableVectorLike DVS.Vector Word64 where+ sImap = DVS.imap+ sMap = DVS.map+ sUnfoldr = DVS.unfoldr+ sUnfoldrN = DVS.unfoldrN+ {-# INLINABLE sImap #-}+ {-# INLINABLE sMap #-}+ {-# INLINABLE sUnfoldr #-}+ {-# INLINABLE sUnfoldrN #-}
+ src/HaskellWorks/Data/Vector/VectorLike.hs view
@@ -0,0 +1,288 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE TypeFamilies #-}++module HaskellWorks.Data.Vector.VectorLike+ ( VectorLike(..)+ ) where++import qualified Data.ByteString as BS+import qualified Data.Vector as DV+import qualified Data.Vector.Storable as DVS+import Data.Word+import HaskellWorks.Data.Positioning++-- | Class of values that support vector like operations+class VectorLike v where+ type Elem v+ (!!!) :: v -> Position -> Elem v+ vConcat :: [v] -> v+ vEmpty :: v+ vFilter :: (Elem v -> Bool) -> v -> v+ vGenerate :: Int -> (Int -> Elem v) -> v+ vLength :: v -> Count+ vSnoc :: v -> Elem v -> v+ vDrop :: Count -> v -> v+ vTake :: Count -> v -> v+ vIndex :: v -> Position -> Elem v+ vSlice :: Position -> Position -> v -> v++instance VectorLike String where+ type Elem String = Char+ (!!!) v (Position i) = v !! fromIntegral i+ vConcat = concat+ vEmpty = ""+ vFilter = filter+ vGenerate n f = f `fmap` [0 .. (n - 1)]+ vLength = Count . fromIntegral . length+ vSnoc v c = v ++ [c]+ vDrop = drop . fromIntegral+ vTake = take . fromIntegral+ vIndex v (Position i) = v !! fromIntegral i+ vSlice (Position i) (Position j) = take (fromIntegral j) . drop (fromIntegral i)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike BS.ByteString where+ type Elem BS.ByteString = Word8++ (!!!) v (Position i) = v `BS.index` fromIntegral i+ vConcat = BS.concat+ vEmpty = BS.empty+ vFilter = BS.filter+ vGenerate n f = fst (BS.unfoldrN n go 0)+ where go i = if i /= n then Just (f i, i + 1) else Nothing+ vLength = Count . fromIntegral . BS.length+ vSnoc = BS.snoc+ vDrop = BS.drop . fromIntegral+ vTake = BS.take . fromIntegral+ vIndex v (Position i) = BS.index v (fromIntegral i)+ vSlice (Position i) (Position j) = BS.take (fromIntegral j) . BS.drop (fromIntegral i)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DV.Vector Word8) where+ type Elem (DV.Vector Word8) = Word8++ (!!!) v (Position i) = v DV.! fromIntegral i+ vConcat = DV.concat+ vEmpty = DV.empty+ vFilter = DV.filter+ vGenerate = DV.generate+ vLength = Count . fromIntegral . DV.length+ vSnoc = DV.snoc+ vDrop = DV.drop . fromIntegral+ vTake = DV.take . fromIntegral+ vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DV.Vector Word16) where+ type Elem (DV.Vector Word16) = Word16++ (!!!) v (Position i) = v DV.! fromIntegral i+ vConcat = DV.concat+ vEmpty = DV.empty+ vFilter = DV.filter+ vGenerate = DV.generate+ vLength = Count . fromIntegral . DV.length+ vSnoc = DV.snoc+ vDrop = DV.drop . fromIntegral+ vTake = DV.take . fromIntegral+ vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DV.Vector Word32) where+ type Elem (DV.Vector Word32) = Word32++ (!!!) v (Position i) = v DV.! fromIntegral i+ vConcat = DV.concat+ vEmpty = DV.empty+ vFilter = DV.filter+ vGenerate = DV.generate+ vLength = Count . fromIntegral . DV.length+ vSnoc = DV.snoc+ vDrop = DV.drop . fromIntegral+ vTake = DV.take . fromIntegral+ vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DV.Vector Word64) where+ type Elem (DV.Vector Word64) = Word64++ (!!!) v (Position i) = v DV.! fromIntegral i+ vConcat = DV.concat+ vEmpty = DV.empty+ vFilter = DV.filter+ vGenerate = DV.generate+ vLength = Count . fromIntegral . DV.length+ vSnoc = DV.snoc+ vDrop = DV.drop . fromIntegral+ vTake = DV.take . fromIntegral+ vIndex v (Position i) = DV.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DV.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DVS.Vector Word8) where+ type Elem (DVS.Vector Word8) = Word8++ (!!!) v (Position i) = v DVS.! fromIntegral i+ vConcat = DVS.concat+ vEmpty = DVS.empty+ vFilter = DVS.filter+ vGenerate = DVS.generate+ vLength = Count . fromIntegral . DVS.length+ vSnoc = DVS.snoc+ vDrop = DVS.drop . fromIntegral+ vTake = DVS.take . fromIntegral+ vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DVS.Vector Word16) where+ type Elem (DVS.Vector Word16) = Word16++ (!!!) v (Position i) = v DVS.! fromIntegral i+ vConcat = DVS.concat+ vEmpty = DVS.empty+ vFilter = DVS.filter+ vGenerate = DVS.generate+ vLength = Count . fromIntegral . DVS.length+ vSnoc = DVS.snoc+ vDrop = DVS.drop . fromIntegral+ vTake = DVS.take . fromIntegral+ vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DVS.Vector Word32) where+ type Elem (DVS.Vector Word32) = Word32++ (!!!) v (Position i) = v DVS.! fromIntegral i+ vConcat = DVS.concat+ vEmpty = DVS.empty+ vFilter = DVS.filter+ vGenerate = DVS.generate+ vLength = Count . fromIntegral . DVS.length+ vSnoc = DVS.snoc+ vDrop = DVS.drop . fromIntegral+ vTake = DVS.take . fromIntegral+ vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}++instance VectorLike (DVS.Vector Word64) where+ type Elem (DVS.Vector Word64) = Word64++ (!!!) v (Position i) = v DVS.! fromIntegral i+ vConcat = DVS.concat+ vEmpty = DVS.empty+ vFilter = DVS.filter+ vGenerate = DVS.generate+ vLength = Count . fromIntegral . DVS.length+ vSnoc = DVS.snoc+ vDrop = DVS.drop . fromIntegral+ vTake = DVS.take . fromIntegral+ vIndex v (Position i) = DVS.unsafeIndex v (fromIntegral i)+ vSlice (Position i) (Position j) = DVS.unsafeSlice (fromIntegral i) (fromIntegral j)+ {-# INLINE (!!!) #-}+ {-# INLINE vConcat #-}+ {-# INLINE vEmpty #-}+ {-# INLINE vFilter #-}+ {-# INLINE vGenerate #-}+ {-# INLINE vLength #-}+ {-# INLINE vSnoc #-}+ {-# INLINE vDrop #-}+ {-# INLINE vTake #-}+ {-# INLINE vIndex #-}+ {-# INLINE vSlice #-}
+ test/HaskellWorks/Data/SearchSpec.hs view
@@ -0,0 +1,11 @@++module HaskellWorks.Data.SearchSpec (spec) where++import Test.Hspec++{-# ANN module ("HLint: ignore Redundant do" :: String) #-}++spec :: Spec+spec = describe "HaskellWorks.Data.BitReadSpec" $ do+ it "No tests" $ do+ "" `shouldBe` ""
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}