packages feed

dstring 0.3.0.2 → 0.4

raw patch · 2 files changed

+16/−21 lines, 2 filesdep −to-string-classdep ~basePVP ok

version bump matches the API change (PVP)

Dependencies removed: to-string-class

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.DString: instance ToString DString
+ Data.DString: toString :: DString -> String

Files

Data/DString.hs view
@@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Data.DString--- Copyright   :  (c) 2009 Bas van Dijk+-- Copyright   :  (c) 2009-2010 Bas van Dijk -- License     :  BSD-style (see the file LICENSE) -- Maintainer  :  Bas van Dijk <v.dijk.bas@gmail.com> -- Stability   :  experimental@@ -25,6 +25,7 @@     ( DString      -- * Conversion+    , toString     , fromDList     , toDList     , fromShowS@@ -47,8 +48,9 @@ -- Imports -------------------------------------------------------------------------------- +-- from base: import Prelude       ( fromInteger, (>=), error )-import Data.Char     ( Char )+import Data.Char     ( Char, String ) import Data.Function ( ($), const, flip ) import Data.List     ( map ) import Data.Maybe    ( Maybe )@@ -60,9 +62,6 @@ -- from base-unicode-symbols: import Data.Function.Unicode ( (∘) ) --- from to-string-class:-import Data.String.ToString ( ToString, toString )- -- from dlist: import           Data.DList      ( DList(DL), unDL, toList, fromList ) import qualified Data.DList as D ( cons, snoc@@ -88,29 +87,19 @@ -- > {-# LANGUAGE OverloadedStrings #-} -- > -- > import Data.DString (toShowS, fromShowS)--- > import Data.String.Combinators ((<+>), paren)+-- > import Data.String.Combinators ((<+>), parens, thenParens) -- > -- > data Tree a = Leaf a | Branch (Tree a) (Tree a) -- > -- > instance Show a => Show (Tree a) where--- >     showsPrec prec = showParen (prec >= funAppPrec) . toShowS . go+-- >     showsPrec prec t = toShowS $ (prec >= funAppPrec) `thenParens` go t -- >         where -- >           go (Leaf x)     = "Leaf" <+> fromShowS (showsPrec funAppPrec x)--- >           go (Branch l r) = "Branch" <+> paren (go l) <+> paren (go r)+-- >           go (Branch l r) = "Branch" <+> parens (go l) <+> parens (go r) -- > -- >           funAppPrec = 10------ Note that a @DString@ can be converted from and to a 'String' using the--- 'fromString' and 'toString' methods from the 'IsString' and 'ToString'--- classes respectively. newtype DString = DS (DList Char) deriving (Monoid, Typeable) -instance IsString DString where-    fromString = fromDList ∘ fromList--instance ToString DString where-    toString = toList ∘ toDList- instance Show DString where     showsPrec p ds = showParen (p >= 10) $                      showString "Data.String.fromString " ∘@@ -120,6 +109,13 @@ -------------------------------------------------------------------------------- -- Conversions --------------------------------------------------------------------------------++instance IsString DString where+    fromString = fromDList ∘ fromList++-- | O(n) Convert a difference string to a normal string.+toString ∷ DString → String+toString = toList ∘ toDList  -- | O(1) Convert a difference list of @Char@s to a difference string. fromDList ∷ DList Char → DString
dstring.cabal view
@@ -1,5 +1,5 @@ Name:               dstring-Version:            0.3.0.2+Version:            0.4 Synopsis:           Difference strings Description:   Difference strings: a data structure for O(1) append on strings. Note that a@@ -23,9 +23,8 @@   Location: http://code.haskell.org/~basvandijk/code/dstring  Library-  Build-Depends: base                 >= 4     && < 4.3+  Build-Depends: base                 >= 4     && < 4.4                , base-unicode-symbols >= 0.1.1 && < 0.3                , dlist                >= 0.5   && < 0.6-               , to-string-class      >= 0.1.2 && < 0.2   Exposed-modules: Data.DString   Ghc-options: -Wall