packages feed

archive-tar-bytestring (empty) → 0.1.0.0

raw patch · 4 files changed

+113/−0 lines, 4 filesdep +basedep +bytestringdep +composition-prelude

Dependencies added: base, bytestring, composition-prelude, tar-bytestring, text, unix

Files

+ CHANGELOG.md view
@@ -0,0 +1,3 @@+# 0.1.0.0++  * Initial release
+ LICENSE view
@@ -0,0 +1,11 @@+Copyright Vanessa McHale (c) 2020++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ archive-tar-bytestring.cabal view
@@ -0,0 +1,52 @@+cabal-version:   2.0+name:            archive-tar-bytestring+version:         0.1.0.0+license:         BSD3+license-file:    LICENSE+copyright:       Copyright: (c) 2020 Vanessa McHale+maintainer:      vamchale@gmail.com+author:          Vanessa McHale+synopsis:        Common interface using the tar-bytestring package+description:+    Backpack-ified way to use [tar-bytestring](http://hackage.haskell.org/package/tar-bytestring) bindings++category:        Codec, Tar, Archive+build-type:      Simple+extra-doc-files: CHANGELOG.md++source-repository head+    type:     git+    location: https://github.com/vmchale/archive-backpack+    subdir:   archive-tar-bytestring++flag development+    description: Enable `-Werror`+    default:     False+    manual:      True++library+    exposed-modules:    Archive.Tar+    build-tool-depends: cpphs:cpphs -any+    hs-source-dirs:     src+    other-modules:      Paths_archive_tar_bytestring+    autogen-modules:    Paths_archive_tar_bytestring+    default-language:   Haskell2010+    ghc-options:        -Wall+    build-depends:+        base >=4.3 && <5,+        tar-bytestring -any,+        bytestring -any,+        text,+        unix,+        composition-prelude >=2.0.3.0++    if flag(development)+        ghc-options: -Werror++    if impl(ghc >=8.0)+        ghc-options:+            -Wincomplete-uni-patterns -Wincomplete-record-updates+            -Wredundant-constraints -Widentities++    if impl(ghc >=8.4)+        ghc-options: -Wmissing-export-lists
+ src/Archive/Tar.cpphs view
@@ -0,0 +1,47 @@+{-# LANGUAGE OverloadedStrings #-}++module Archive.Tar ( Entry+                   , Error+                   , writeArchiveBytes+                   , unpackToDir+                   , readArchiveBytes+                   , packFiles+                   , versionInfo+                   ) where++import           Codec.Archive.Tar                (Entries (..))+import qualified Codec.Archive.Tar                as Tar+import           Control.Composition              ((.@))+import qualified Data.ByteString.Lazy             as BSL+import qualified Data.Text                        as T+import           Data.Text.Encoding               (encodeUtf8)+import qualified Data.Version                     as V+import qualified Paths_archive_tar_bytestring     as P+import           System.Posix.ByteString.FilePath (RawFilePath)++type Entry = Tar.Entry++type Error = Tar.FormatError++convertFilePath :: FilePath -> RawFilePath+convertFilePath = encodeUtf8 . T.pack++coerceToList :: Entries a -> Either a [Entry]+coerceToList (Next e es) = (e :) <$> coerceToList es+coerceToList Done        = Right []+coerceToList (Fail ex)   = Left ex++writeArchiveBytes :: [Entry] -> BSL.ByteString+writeArchiveBytes = Tar.write++readArchiveBytes :: BSL.ByteString -> Either Error [Entry]+readArchiveBytes = coerceToList . Tar.read++unpackToDir :: FilePath -> BSL.ByteString -> IO ()+unpackToDir = Tar.read .@ Tar.unpack . convertFilePath++packFiles :: [FilePath] -> IO BSL.ByteString+packFiles = fmap Tar.write . Tar.pack "." . fmap convertFilePath++versionInfo :: String+versionInfo = "tar-bytestring: " ++ VERSION_tar_bytestring ++ "\narchive-tar-bytestring: " ++ V.showVersion P.version