cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.Compat.Tar

Contents

- Orphan instances

Synopsis

- extractTarGzFile :: FilePath -> FilePath -> FilePath -> IO ()
- type Entry = GenEntry TarPath LinkTarget
- type Entries e = GenEntries TarPath LinkTarget e
- data GenEntries tarPath linkTarget e
  - = Next (GenEntry tarPath linkTarget) (GenEntries tarPath linkTarget e)
  - | Done
  - | Fail e
- data GenEntryContent linkTarget
  - = NormalFile ByteString !FileSize
  - | Directory
  - | SymbolicLink !linkTarget
  - | HardLink !linkTarget
  - | CharacterDevice !DevMajor !DevMinor
  - | BlockDevice !DevMajor !DevMinor
  - | NamedPipe
  - | OtherEntryType !TypeCode ByteString !FileSize
- entryContent :: GenEntry tarPath linkTarget -> GenEntryContent linkTarget

# Documentation

extractTarGzFile #

Arguments

:: FilePath | Destination directory
-> FilePath | Expected subdir (to check for tarbombs)
-> FilePath | Tarball
-> IO () |

type Entry = GenEntry TarPath LinkTarget #

Monomorphic tar archive entry, ready for serialization / deserialization.

type Entries e = GenEntries TarPath LinkTarget e #

Monomorphic sequence of archive entries, ready for serialization / deserialization.

data GenEntries tarPath linkTarget e #

Polymorphic sequence of archive entries. High-level interfaces commonly work with `GenEntries` `FilePath` `FilePath`, while low-level ones use `GenEntries` `TarPath` `LinkTarget`.

The point of this type as opposed to just using a list is that it makes the failure case explicit. We need this because the sequence of entries we get from reading a tarball can include errors.

Converting from a list can be done with just `foldr Next Done`. Converting back into a list can be done with `foldEntries` however in that case you must be prepared to handle the `Fail` case inherent in the `Entries` type.

The `Monoid` instance lets you concatenate archives or append entries to an archive.

Since: tar-0.6.0.0

Constructors

Next (GenEntry tarPath linkTarget) (GenEntries tarPath linkTarget e) infixr 5 |
Done |
Fail e |

#### Instances

Instances details

Functor (GenEntries tarPath linkTarget) |
Instance details Defined in Codec.Archive.Tar.Types Methods fmap :: (a -> b) -> GenEntries tarPath linkTarget a -> GenEntries tarPath linkTarget b # (<$) :: a -> GenEntries tarPath linkTarget b -> GenEntries tarPath linkTarget a #
Foldable (GenEntries tarPath linkTarget) | Since: tar-0.6.0.0
Instance details Defined in Codec.Archive.Tar.Types Methods fold :: Monoid m => GenEntries tarPath linkTarget m -> m # foldMap :: Monoid m => (a -> m) -> GenEntries tarPath linkTarget a -> m # foldMap' :: Monoid m => (a -> m) -> GenEntries tarPath linkTarget a -> m # foldr :: (a -> b -> b) -> b -> GenEntries tarPath linkTarget a -> b # foldr' :: (a -> b -> b) -> b -> GenEntries tarPath linkTarget a -> b # foldl :: (b -> a -> b) -> b -> GenEntries tarPath linkTarget a -> b # foldl' :: (b -> a -> b) -> b -> GenEntries tarPath linkTarget a -> b # foldr1 :: (a -> a -> a) -> GenEntries tarPath linkTarget a -> a # foldl1 :: (a -> a -> a) -> GenEntries tarPath linkTarget a -> a # toList :: GenEntries tarPath linkTarget a -> [a] # null :: GenEntries tarPath linkTarget a -> Bool # length :: GenEntries tarPath linkTarget a -> Int # elem :: Eq a => a -> GenEntries tarPath linkTarget a -> Bool # maximum :: Ord a => GenEntries tarPath linkTarget a -> a # minimum :: Ord a => GenEntries tarPath linkTarget a -> a # sum :: Num a => GenEntries tarPath linkTarget a -> a # product :: Num a => GenEntries tarPath linkTarget a -> a #
Traversable (GenEntries tarPath linkTarget) | Since: tar-0.6.0.0
Instance details Defined in Codec.Archive.Tar.Types Methods traverse :: Applicative f => (a -> f b) -> GenEntries tarPath linkTarget a -> f (GenEntries tarPath linkTarget b) # sequenceA :: Applicative f => GenEntries tarPath linkTarget (f a) -> f (GenEntries tarPath linkTarget a) # mapM :: Monad m => (a -> m b) -> GenEntries tarPath linkTarget a -> m (GenEntries tarPath linkTarget b) # sequence :: Monad m => GenEntries tarPath linkTarget (m a) -> m (GenEntries tarPath linkTarget a) #
(NFData tarPath, NFData linkTarget, NFData e) => NFData (GenEntries tarPath linkTarget e) |
Instance details Defined in Codec.Archive.Tar.Types Methods rnf :: GenEntries tarPath linkTarget e -> () #
Monoid (GenEntries tarPath linkTarget e) |
Instance details Defined in Codec.Archive.Tar.Types Methods mempty :: GenEntries tarPath linkTarget e # mappend :: GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e # mconcat :: [GenEntries tarPath linkTarget e] -> GenEntries tarPath linkTarget e #
Semigroup (GenEntries tarPath linkTarget e) | Since: tar-0.5.1.0
Instance details Defined in Codec.Archive.Tar.Types Methods (<>) :: GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e # sconcat :: NonEmpty (GenEntries tarPath linkTarget e) -> GenEntries tarPath linkTarget e # stimes :: Integral b => b -> GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e #
(Show tarPath, Show linkTarget, Show e) => Show (GenEntries tarPath linkTarget e) |
Instance details Defined in Codec.Archive.Tar.Types Methods showsPrec :: Int -> GenEntries tarPath linkTarget e -> ShowS # show :: GenEntries tarPath linkTarget e -> String # showList :: [GenEntries tarPath linkTarget e] -> ShowS #
(Eq tarPath, Eq linkTarget, Eq e) => Eq (GenEntries tarPath linkTarget e) |
Instance details Defined in Codec.Archive.Tar.Types Methods (==) :: GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e -> Bool # (/=) :: GenEntries tarPath linkTarget e -> GenEntries tarPath linkTarget e -> Bool #

data GenEntryContent linkTarget #

Polymorphic content of a tar archive entry. High-level interfaces commonly work with `GenEntryContent` `FilePath`, while low-level ones use `GenEntryContent` `LinkTarget`.

Portable archives should contain only `NormalFile` and `Directory`.

Since: tar-0.6.0.0

Constructors

NormalFile ByteString !FileSize |
Directory |
SymbolicLink !linkTarget |
HardLink !linkTarget |
CharacterDevice !DevMajor !DevMinor |
BlockDevice !DevMajor !DevMinor |
NamedPipe |
OtherEntryType !TypeCode ByteString !FileSize |

#### Instances

Instances details

Functor GenEntryContent | Since: tar-0.6.4.0
Instance details Defined in Codec.Archive.Tar.Types Methods fmap :: (a -> b) -> GenEntryContent a -> GenEntryContent b # (<$) :: a -> GenEntryContent b -> GenEntryContent a #
NFData linkTarget => NFData (GenEntryContent linkTarget) |
Instance details Defined in Codec.Archive.Tar.Types Methods rnf :: GenEntryContent linkTarget -> () #
Show linkTarget => Show (GenEntryContent linkTarget) |
Instance details Defined in Codec.Archive.Tar.Types Methods showsPrec :: Int -> GenEntryContent linkTarget -> ShowS # show :: GenEntryContent linkTarget -> String # showList :: [GenEntryContent linkTarget] -> ShowS #
Eq linkTarget => Eq (GenEntryContent linkTarget) |
Instance details Defined in Codec.Archive.Tar.Types Methods (==) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool # (/=) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool #
Ord linkTarget => Ord (GenEntryContent linkTarget) |
Instance details Defined in Codec.Archive.Tar.Types Methods compare :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Ordering # (<) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool # (<=) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool # (>) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool # (>=) :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> Bool # max :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> GenEntryContent linkTarget # min :: GenEntryContent linkTarget -> GenEntryContent linkTarget -> GenEntryContent linkTarget #

entryContent :: GenEntry tarPath linkTarget -> GenEntryContent linkTarget #

The real content of the entry. For `NormalFile` this includes the file data. An entry usually contains a `NormalFile` or a `Directory`.

# Orphan instances

(Exception a, Exception b) => Exception (Either a b) # |
Instance details Methods toException :: Either a b -> SomeException # fromException :: SomeException -> Maybe (Either a b) # displayException :: Either a b -> String # backtraceDesired :: Either a b -> Bool #