vector-split 1.0.0.0 → 1.0.0.2
raw patch · 3 files changed
+16/−32 lines, 3 filesdep ~vector
Dependency ranges changed: vector
Files
- src/Data/Vector/Split.hs +3/−3
- src/Data/Vector/Split/Internal.hs +1/−21
- vector-split.cabal +12/−8
src/Data/Vector/Split.hs view
@@ -51,8 +51,8 @@ splitPlaces :: Vector v a => [Int] -> v a -> [v a] splitPlaces is v = unfoldr go (is,v) where go ([],_) = Nothing- go (i:is,v) | V.null v = Nothing- | otherwise = let (l,r) = V.splitAt i v in Just (l,(is,r))+ go (x:xs,y) | V.null y = Nothing+ | otherwise = let (l,r) = V.splitAt x y in Just (l,(xs,r)) -- | Split a vector into chunks of the given lengths. Unlike@@ -72,7 +72,7 @@ splitPlacesBlanks :: Vector v a => [Int] -> v a -> [v a] splitPlacesBlanks is v = unfoldr go (is,v) where go ([],_) = Nothing- go (i:is,v) = let (l,r) = V.splitAt i v in Just (l,(is,r))+ go (x:xs,y) = let (l,r) = V.splitAt x y in Just (l,(xs,r))
src/Data/Vector/Split/Internal.hs view
@@ -3,7 +3,7 @@ module Data.Vector.Split.Internal ( split- , Splitter(..)+ , Splitter , splitOn , splitOneOf , splitWhen@@ -34,8 +34,6 @@ import qualified Data.Vector as BV -import qualified Data.List as L- -- | A delimiter is a list of predicates on elements, matched by some -- contiguous subsequence of a list. newtype Delimiter a = Delimiter (BV.Vector (a -> Bool))@@ -55,14 +53,6 @@ deriving (Show, Eq) -fromChunk :: Chunk v a -> v a-fromChunk (Delim d) = d-fromChunk (Text t) = t--isDelim :: Chunk v a -> Bool-isDelim (Delim _) = True-isDelim (Text _) = False- type SplitList v a = [Chunk v a] type Splitter v a = v a -> SplitList v a@@ -326,13 +316,3 @@ endsWithOneOf :: (Vector v a, Eq a) => v a -> Splitter v a endsWithOneOf xs = dropFinalBlank . keepDelimsR . oneOf xs ------- Util--intercalateV :: Vector v a => v a -> [v a] -> v a-intercalateV d = go- where go [x] = x- go (x:xs) = x V.++ d V.++ go xs
vector-split.cabal view
@@ -1,14 +1,18 @@ name: vector-split-version: 1.0.0.0-synopsis: Initial project template from stack-description: Please see README.md-homepage: https://github.com/fhaust/vector-split#readme-license: BSD3+version: 1.0.0.2+synopsis: Combinator library for splitting vectors.+description: This package aims to be a vector-based drop-in replacement+ for the list-based split package.+ For more information see the haddocs or checkout the source+ on github.+homepage: https://github.com/fhaust/vector-split+bug-reports: https://github.com/fhaust/vector-split/issues+license: MIT license-file: LICENSE author: Florian Hofmann maintainer: fho@f12n.de-copyright: MIT-category: Web+copyright: (c) Florian Hofmann 2016+category: Data, Data Structures build-type: Simple -- extra-source-files: cabal-version: >=1.10@@ -18,7 +22,7 @@ exposed-modules: Data.Vector.Split , Data.Vector.Split.Internal build-depends: base >= 4 && < 5- , vector >= 0.10 && < 0.12+ , vector >= 0.10 && < 0.13 default-language: Haskell2010 ghc-options: -Wall