packages feed

dstring 0.4.0.2 → 0.4.0.3

raw patch · 2 files changed

+25/−4 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/DString.hs view
@@ -1,10 +1,13 @@ {-# LANGUAGE CPP            , UnicodeSyntax            , NoImplicitPrelude-           , GeneralizedNewtypeDeriving            , DeriveDataTypeable   #-} +#if __GLASGOW_HASKELL__ >= 704+{-# LANGUAGE Safe #-}+#endif+ ----------------------------------------------------------------------------- -- | -- Module      :  Data.DString@@ -55,7 +58,7 @@ import Data.Function ( ($), const, flip ) import Data.List     ( map ) import Data.Maybe    ( Maybe )-import Data.Monoid   ( Monoid )+import Data.Monoid   ( Monoid, mempty, mappend ) import Data.Typeable ( Typeable ) import Data.String   ( IsString, fromString ) import Text.Show     ( Show, showsPrec, ShowS, showParen, showString, shows )@@ -109,40 +112,52 @@ -- >           go (Branch l r) = "Branch" <+> parens (go l) <+> parens (go r) -- > -- >           funAppPrec = 10-newtype DString = DS (DList Char) deriving (Monoid, Typeable)+newtype DString = DS (DList Char) deriving (Typeable)  instance Show DString where     showsPrec p ds = showParen (p >= 10) $                      showString "Data.String.fromString " ∘                      shows (toString ds) +instance Monoid DString where+    mempty = fromDList mempty+    ds1 `mappend` ds2 = fromDList $ toDList ds1 `mappend` toDList ds2+    {-# INLINE mempty #-}+    {-# INLINE mappend #-} + -------------------------------------------------------------------------------- -- Conversions --------------------------------------------------------------------------------  instance IsString DString where     fromString = fromDList ∘ fromList+    {-# INLINE fromString #-}  -- | O(n) Convert a difference string to a normal string. toString ∷ DString → String toString = toList ∘ toDList+{-# INLINE toString #-}  -- | O(1) Convert a difference list of @Char@s to a difference string. fromDList ∷ DList Char → DString fromDList = DS+{-# INLINE fromDList #-}  -- | O(1) Convert a difference string to a difference list. toDList ∷ DString → DList Char toDList (DS dl) = dl+{-# INLINE toDList #-}  -- | O(1) Convert a @ShowS@ to a difference string. fromShowS ∷ ShowS → DString fromShowS = fromDList ∘ DL+{-# INLINE fromShowS #-}  -- | O(1) Convert a difference string to a @ShowS@. toShowS ∷ DString → ShowS toShowS = unDL ∘ toDList+{-# INLINE toShowS #-}   --------------------------------------------------------------------------------@@ -152,18 +167,22 @@ -- | O(1) Build a difference string from a single @Char@. singleton ∷ Char → DString singleton = fromDList ∘ D.singleton+{-# INLINE singleton #-}  -- | /O(1)/, Prepend a Char to a difference string. cons ∷ Char → DString → DString cons c ds = fromDList $ D.cons c (toDList ds)+{-# INLINE cons #-}  -- | /O(1)/, Append a @Char@ to a difference string. snoc ∷ DString → Char → DString snoc ds c = fromDList $ D.snoc (toDList ds) c+{-# INLINE snoc #-}  -- | /O(spine)/, Concatenate difference strings. concat ∷ [DString] → DString concat = fromDList ∘ D.concat ∘ map toDList+{-# INLINE concat #-}  -- | /O(length ds)/, difference list elimination, head, tail. list ∷ α → (Char → DString → α) → DString → α@@ -183,7 +202,9 @@ -- | Unfoldr for difference strings. unfoldr ∷ (α → Maybe (Char, α)) → α → DString unfoldr pf b = fromDList $ D.unfoldr pf b+{-# INLINE unfoldr #-}  -- | Foldr over difference strings. foldr  ∷ (Char → α → α) → α → DString → α foldr f b = D.foldr f b ∘ toDList+{-# INLINE foldr #-}
dstring.cabal view
@@ -1,5 +1,5 @@ Name:               dstring-Version:            0.4.0.2+Version:            0.4.0.3 Synopsis:           Difference strings Description:   Difference strings: a data structure for O(1) append on strings. Note that a