packages feed

dlist 0.4.1 → 0.5

raw patch · 3 files changed

+18/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.DList: replicate :: Int -> a -> DList a

Files

Data/DList.hs view
@@ -27,6 +27,7 @@   ,snoc          -- :: DList a -> a -> DList a   ,append        -- :: DList a -> DList a -> DList a   ,concat        -- :: [DList a] -> DList a+  ,replicate     -- :: Int -> a -> DList a   ,list          -- :: b -> (a -> DList a -> b) -> DList a -> b   ,head          -- :: DList a -> a   ,tail          -- :: DList a -> DList a@@ -39,7 +40,7 @@    ) where -import Prelude hiding (concat, foldr, map, head, tail)+import Prelude hiding (concat, foldr, map, head, tail, replicate) import qualified Data.List as List import Control.Monad import Data.Monoid@@ -113,7 +114,14 @@ concat       = List.foldr append empty {-# INLINE concat #-} --- | /O(length dl)/, List elimination, head, tail. +-- | /O(n)/, Create a difference list of the given number of elements+replicate :: Int -> a -> DList a+replicate n x = DL $ \xs -> let go m | m <= 0    = xs+                                     | otherwise = x : go (m-1)+                            in go n+{-# INLINE replicate #-}++-- | /O(length dl)/, List elimination, head, tail. list :: b -> (a -> DList a -> b) -> DList a -> b list nill consit dl =   case toList dl of
dlist.cabal view
@@ -1,5 +1,5 @@ Name:                dlist-Version:             0.4.1+Version:             0.5 Synopsis:            Differences lists Description:              Differences lists: a list-like type supporting O(1) append.@@ -11,7 +11,7 @@ License-file:        LICENSE Author:              Don Stewart  Maintainer:          dons@galois.com-Copyright:           2006-7 Don Stewart+Copyright:           2006-9 Don Stewart Homepage:            http://code.haskell.org/~dons/code/dlist/ extra-source-files:  README tests/Properties.hs tests/Parallel.hs build-type:          Simple@@ -25,7 +25,7 @@     Extensions:          CPP     Exposed-modules:     Data.DList     if flag(applicative-in-base)-        build-depends: base >= 2.0+        build-depends: base >= 2.0 && < 5         cpp-options: -DAPPLICATIVE_IN_BASE     else         build-depends: base < 2.0
tests/Properties.hs view
@@ -1,8 +1,8 @@  import qualified Prelude   as P import qualified Data.List as P (unfoldr)-import Prelude          hiding (concat,map,head,tail,foldr,map)-import Data.List        hiding (concat,map,head,tail,unfoldr,foldr,map)+import Prelude          hiding (concat,map,head,tail,foldr,map,replicate)+import Data.List        hiding (concat,map,head,tail,unfoldr,foldr,map,replicate) import Text.Show.Functions  import Parallel@@ -25,6 +25,8 @@ prop_concat zss  = (P.concat zss) == toList (concat (P.map fromList zss))     where _ = zss :: [T] +prop_replicate n x = (P.replicate n x :: T) == toList (replicate n x)+ prop_head xs = not (null xs) ==> (P.head xs) == head (fromList xs)     where _ = xs :: T @@ -58,6 +60,7 @@     , ("snoc",      pDet prop_snoc)     , ("append",    pDet prop_append)     , ("concat",    pDet prop_concat)+    , ("replicate", pDet prop_replicate)     , ("head",      pDet prop_head)     , ("tail",      pDet prop_tail)     , ("unfoldr",   pDet prop_unfoldr)