packages feed

ListLike 4.7.4 → 4.7.6

raw patch · 14 files changed

+82/−69 lines, 14 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.ListLike.Instances: instance GHC.Exts.IsList Data.ByteString.Internal.ByteString
+ Data.ListLike.Instances: instance GHC.Exts.IsList Data.ByteString.Lazy.Internal.ByteString

Files

CHANGELOG.md view
@@ -1,6 +1,10 @@ CHANGES ======= +### 4.7.5++  - warning-free for `-Wall` and `-Wcompat`+ ### 4.7.4 (2021-01-07)    - support utf8-string-1.0.2 ([#10](https://github.com/ddssff/listlike/issues/10))
ListLike.cabal view
@@ -1,7 +1,7 @@ Name: ListLike-Version: 4.7.4+Version: 4.7.6 License: BSD3-Maintainer: David Fox <dsf@seereason.com>+Maintainer: David Fox <dsf@seereason.com>, Andreas Abel Author: John Goerzen Copyright: Copyright (c) 2007-2008 John Goerzen license-file: COPYRIGHT@@ -23,7 +23,8 @@ Stability: Stable  Tested-With:-  GHC == 8.10.3+  GHC == 9.0.1+  GHC == 8.10.4   GHC == 8.8.4   GHC == 8.6.5   GHC == 8.4.4@@ -87,6 +88,9 @@    If !impl(ghc >= 8.4)     Build-Depends: semigroups >= 0.16 && < 0.20++  if impl(ghc >= 8.0)+    ghc-options:  -Wcompat  Test-suite listlike-tests   default-language: Haskell2010
README.md view
@@ -6,6 +6,6 @@  The `ListLike` package provides typeclasses and instances that polymorphically generalize list operations to many list-like types-such as vectors, text, or difference lists.+such as vectors, text, bytestrings, or difference lists.  Read the [introduction](https://hackage.haskell.org/package/ListLike/docs/Data-ListLike.html).
src/Data/ListLike.hs view
@@ -12,8 +12,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Goerzen <jgoerzen@complete.org>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Generic operations over list-like structures
src/Data/ListLike/Base.hs view
@@ -22,8 +22,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Generic operations over list-like structures
src/Data/ListLike/CharString.hs view
@@ -1,7 +1,9 @@-{-# LANGUAGE MultiParamTypeClasses+{-# LANGUAGE CPP+            ,MultiParamTypeClasses             ,FlexibleInstances             ,TypeFamilies-            ,TypeSynonymInstances #-}+            ,TypeSynonymInstances+            ,GeneralizedNewtypeDeriving #-}   {-@@ -18,8 +20,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Newtype wrapper for ByteString to enable a Char-based interface@@ -49,7 +51,9 @@ import           Data.ListLike.IO import           Data.ListLike.FoldableLL import           Data.Int+#if !MIN_VERSION_base(4,11,0) import           Data.Semigroup (Semigroup(..))+#endif import           Data.String (IsString(..)) import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy.Char8 as BSL@@ -64,14 +68,7 @@ -- | Newtype wrapper around Data.ByteString.Char8.ByteString, --   this allows for ListLike instances with Char elements. newtype CharString = CS { unCS :: BS.ByteString }-  deriving (Read, Show, Eq, Ord)--instance Semigroup CharString where-  (<>) = mappend--instance Monoid CharString where-  mempty = CS mempty-  mappend l r = CS $ mappend (unCS l) (unCS r)+  deriving (Read, Show, Eq, Ord, Semigroup, Monoid)  instance FoldableLL CharString Char where     foldl f i0  ls = BS.foldl f i0 (unCS ls)@@ -189,14 +186,7 @@ -- | Newtype wrapper around Data.ByteString.Lazy.Char8.ByteString, --   this allows for ListLike instances with Char elements. newtype CharStringLazy = CSL { unCSL :: BSL.ByteString }-  deriving (Read, Show, Eq, Ord)--instance Semigroup CharStringLazy where-  (<>) = mappend--instance Monoid CharStringLazy where-  mempty = CSL mempty-  mappend l r = CSL $ mappend (unCSL l) (unCSL r)+  deriving (Read, Show, Eq, Ord, Semigroup, Monoid)  instance FoldableLL CharStringLazy Char where     foldl f i0  ls = BSL.foldl f i0 (unCSL ls)
src/Data/ListLike/Chars.hs view
@@ -1,4 +1,3 @@--- | Work in progress. {-# LANGUAGE CPP             ,MultiParamTypeClasses             ,TypeFamilies@@ -15,7 +14,9 @@ import           Control.DeepSeq --import           Control.Monad import           Data.String as String (IsString)-import           Data.Semigroup (Semigroup(..))+#if !MIN_VERSION_base(4,11,0)+import Data.Semigroup (Semigroup(..))+#endif import qualified Data.Text.Lazy as T --import qualified Data.Text.Lazy.IO as TI import qualified Data.Text.Lazy.Builder as Builder@@ -38,11 +39,11 @@ {-# INLINE builder #-}  instance Semigroup Chars where-  (<>) = mappend+  a <> b = B $ builder a <> builder b  instance Monoid Chars where-    mempty = B mempty-    mappend a b = B $ mappend (builder a) (builder b)+  mempty  = B mempty+  mappend = (<>)  instance String.IsString Chars where   -- Builder already has an IsString instance, do we want to use it?
src/Data/ListLike/DList.hs view
@@ -1,20 +1,22 @@ {-# LANGUAGE NoImplicitPrelude, MultiParamTypeClasses, FlexibleInstances #-} {-# OPTIONS -fno-warn-orphans #-} {-# LANGUAGE CPP #-}+ -- | 'Data.ListLike.ListLike' instances for 'Data.DList.DList'+ module Data.ListLike.DList () where---import qualified Prelude as P+ import Data.ListLike.Base import Data.ListLike.FoldableLL---import Data.ListLike.IO import Data.ListLike.String+#if MIN_VERSION_dlist(1,0,0)+import Data.DList.Unsafe (DList(UnsafeDList), unsafeApplyDList)+#else import Data.DList (DList)+#endif import qualified Data.DList as D---import Data.Foldable (Foldable) import qualified Data.Foldable as F---import Data.Traversable (Traversable)---import qualified Data.Traversable as T---import Data.String (IsString)+import qualified Data.List as List import qualified Data.String as S import Control.Category import Data.Char (Char)@@ -35,7 +37,17 @@   append = D.append   head = D.head #if MIN_VERSION_dlist(1,0,0)-  tail = D.fromList . D.tail+  -- Andreas Abel, 2021-09-01, issue #14,+  -- work around https://github.com/spl/dlist/issues/98:+  --+  -- dlist-1.0 changed @tail@ so that it is not an operation+  -- on difference lists anymore, but collapses the difference list+  -- into a plain list.+  --+  -- The following tail function restores the spirit of difference+  -- lists, at the cost of breaking data abstraction, i.e.,+  -- using the constructor and destructor of the newtype DList.+  tail = UnsafeDList . (List.tail .) . unsafeApplyDList #else   tail = D.tail #endif
src/Data/ListLike/FoldableLL.hs view
@@ -16,8 +16,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Generic tools for data structures that can be folded.
src/Data/ListLike/IO.hs view
@@ -16,8 +16,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  String-like functions
src/Data/ListLike/Instances.hs view
@@ -19,8 +19,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Instances of 'Data.ListLike.ListLike' and related classes.@@ -52,8 +52,9 @@ import           Data.ListLike.UTF8 () import           Data.ListLike.Vector () import           Data.Int---import           Data.Maybe (fromMaybe)+#if !MIN_VERSION_base(4,11,0) import           Data.Semigroup (Semigroup(..))+#endif import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BSC --import qualified Data.Foldable as F@@ -386,17 +387,17 @@     foldr' = F.foldr'  instance (Integral i, Ix i) => Semigroup (A.Array i e) where-  (<>) = mappend+  l1 <> l2 = A.array (blow, newbhigh) $+               A.assocs l1 ++ zip [bhigh + 1 .. newbhigh] (A.elems l2)+    where+    newlen        = genericLength newelems+    newelems      = A.elems l2+    newbhigh      = bhigh + newlen+    (blow, bhigh) = A.bounds l1  instance (Integral i, Ix i) => Monoid (A.Array i e) where-    mempty = A.listArray (0, -1) []-    mappend l1 l2 =-        A.array (blow, newbhigh)-              (A.assocs l1 ++ zip [(bhigh + 1)..newbhigh] (A.elems l2))-        where newlen = genericLength newelems-              newelems = A.elems l2-              newbhigh = bhigh + newlen-              (blow, bhigh) = A.bounds l1+  mempty  = A.listArray (0, -1) []+  mappend = (<>)  instance (Integral i, Ix i) => IsList (A.Array i e) where     type Item (A.Array i e) = e
src/Data/ListLike/String.hs view
@@ -12,8 +12,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  String-like functions
src/Data/ListLike/UTF8.hs view
@@ -29,8 +29,9 @@ import Data.ListLike.IO import Data.ListLike.String (StringLike(..)) import Data.Maybe (fromMaybe)-import Data.Monoid (Monoid(..))+#if !MIN_VERSION_base(4,11,0) import Data.Semigroup (Semigroup(..))+#endif #if !MIN_VERSION_utf8_string(1,0,2) import Data.String (IsString(fromString)) #endif@@ -158,11 +159,11 @@     toString = UTF8.toString  instance Semigroup (UTF8 BS.ByteString) where-  (<>) = mappend+  a <> b = UTF8.fromRep $ UTF8.toRep a <> UTF8.toRep b  instance Monoid (UTF8 BS.ByteString) where-    mempty = UTF8.fromString []-    mappend a b = UTF8.fromRep (mappend (UTF8.toRep a) (UTF8.toRep b))+  mempty  = UTF8.fromString []+  mappend = (<>)  -------------------------------------------------- -- UTF8 Lazy.ByteString@@ -272,9 +273,6 @@     -- writeFile = BSL.writeFile     -- appendFile = BSL.appendFile -instance Semigroup (UTF8 BSL.ByteString) where-  (<>) = mappend- #if !MIN_VERSION_utf8_string(1,0,2) instance IsString (UTF8 BSL.ByteString) where     fromString = UTF8.fromString@@ -283,8 +281,11 @@ instance StringLike (UTF8 BSL.ByteString) where     toString = UTF8.toString +instance Semigroup (UTF8 BSL.ByteString) where+  a <> b = UTF8.fromRep $ UTF8.toRep a <> UTF8.toRep b+ instance Monoid (UTF8 BSL.ByteString) where-    mempty = UTF8.fromString []-    mappend a b = UTF8.fromRep (mappend (UTF8.toRep a) (UTF8.toRep b))+  mempty  = UTF8.fromString []+  mappend = (<>)  {-# RULES "fromListLike/a" fromListLike = id :: a -> a #-}
src/Data/ListLike/Utils.hs view
@@ -15,8 +15,8 @@    Copyright  : Copyright (C) 2007 John Goerzen    License    : BSD3 -   Maintainer : John Lato <jwlato@gmail.com>-   Stability  : provisional+   Maintainer : David Fox <dsf@seereason.com>, Andreas Abel+   Stability  : stable    Portability: portable  Utilities for 'Data.ListLike.ListLike' and friends.  More functions