split 0.1.4.2 → 0.1.4.3
raw patch · 4 files changed
+24/−14 lines, 4 files
Files
- CHANGES +11/−0
- Data/List/Split.hs +2/−2
- Data/List/Split/Internals.hs +10/−11
- split.cabal +1/−1
CHANGES view
@@ -1,3 +1,14 @@+* 0.1.4.3 (7 June 2012)++ - Import 'build' function from GHC.Exts instead of defining it by+ hand, which can lead to some speedups (since GHC has special+ rewriting rules for the version in GHC.Exts). Of course this ties+ it to GHC; if you want to build split under some other compiler,+ let me know and I can add some CPP directives to define 'build'+ conditionally.++ - Remove unnecessary Rank2Types extension.+ * 0.1.4.2 (21 December 2011) - Bump version upper bound for base and Test with GHC 7.4.1rc1
Data/List/Split.hs view
@@ -4,8 +4,8 @@ -- Copyright : (c) Brent Yorgey, Louis Wasserman 2008 -- License : BSD-style (see LICENSE) -- Maintainer : Brent Yorgey <byorgey@gmail.com>--- Stability : experimental--- Portability : unportable (GADTs, Rank2Types)+-- Stability : stable+-- Portability : GADTs -- -- The "Data.List.Split" module contains a wide range of strategies -- for splitting lists with respect to some sort of delimiter, mostly
Data/List/Split/Internals.hs view
@@ -1,12 +1,12 @@-{-# LANGUAGE GADTs, Rank2Types #-}+{-# LANGUAGE GADTs #-} ----------------------------------------------------------------------------- -- | -- Module : Data.List.Split.Internal -- Copyright : (c) Brent Yorgey 2008 -- License : BSD-style (see LICENSE) -- Maintainer : byorgey@gmail.com--- Stability : experimental--- Portability : unportable (GADTs, Rank2Types)+-- Stability : stable+-- Portability : GADTs -- -- Implementation module for "Data.List.Split", a combinator library -- for splitting lists. See the "Data.List.Split" documentation for@@ -17,6 +17,11 @@ module Data.List.Split.Internals where import Data.List (genericSplitAt)+import GHC.Exts (build)+ -- Use the build from GHC.Exts because GHC has some rules that make+ -- it faster. If you want to build split under some compiler other+ -- than GHC, let me know; it would be easy to add some CPP+ -- conditionally defining build. -- * Types and utilities @@ -126,10 +131,6 @@ isText (Text _) = True isText _ = False --- | Standard build function.-build :: (forall b. (a -> b -> b) -> b -> b) -> [a]-build g = g (:) []- -- * Implementation -- | Given a delimiter to use, split a list into an internal@@ -494,8 +495,7 @@ -- is total. splitPlaces :: Integral a => [a] -> [e] -> [[e]] splitPlaces is ys = build (splitPlacer is ys) where- splitPlacer :: forall i b t. Integral i- => [i] -> [b] -> ([b] -> t -> t) -> t -> t+ splitPlacer :: Integral i => [i] -> [b] -> ([b] -> t -> t) -> t -> t splitPlacer [] _ _ n = n splitPlacer _ [] _ n = n splitPlacer (l:ls) xs c n = let (x1, x2) = genericSplitAt l xs@@ -510,8 +510,7 @@ -- > splitPlacesBlanks [4,9,3] [1..10] == [[1,2,3,4],[5,6,7,8,9,10],[]] splitPlacesBlanks :: Integral a => [a] -> [e] -> [[e]] splitPlacesBlanks is ys = build (splitPlacer is ys) where- splitPlacer :: forall i b t. Integral i- => [i] -> [b] -> ([b] -> t -> t) -> t -> t+ splitPlacer :: Integral i => [i] -> [b] -> ([b] -> t -> t) -> t -> t splitPlacer [] _ _ n = n splitPlacer (l:ls) xs c n = let (x1, x2) = genericSplitAt l xs in x1 `c` splitPlacer ls x2 c n
split.cabal view
@@ -1,5 +1,5 @@ Name: split-Version: 0.1.4.2+Version: 0.1.4.3 Stability: stable Description: Combinator library and utility functions for splitting lists. Homepage: http://code.haskell.org/~byorgey/code/split