-- GENERATED by C->Haskell Compiler, version 0.28.3 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Codec/Archive/Types/Foreign.chs" #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric  #-}

-- see http://hackage.haskell.org/package/Cabal-3.2.0.0/docs/Distribution-Simple-PreProcess.html#t:PPSuffixHandler

module Codec.Archive.Types.Foreign ( -- * Callbacks
                                     ArchiveReadCallback
                                   , ArchiveSkipCallback
                                   , ArchiveSeekCallback
                                   , ArchiveWriteCallback
                                   , ArchiveCloseCallbackRaw
                                   , ArchiveOpenCallbackRaw
                                   , ArchiveSwitchCallbackRaw
                                   , ArchivePassphraseCallback
                                   , ArchiveFreeCallbackRaw
                                   -- * Abstract types
                                   , Archive
                                   , ArchiveEntry
                                   , Stat
                                   , LinkResolver
                                   -- * Enum types
                                   , ArchiveResult (..)
                                   , FileType (..)
                                   , Symlink (..)
                                   , ArchiveEntryDigest (..)
                                   -- * Macros
                                   , Flags (..)
                                   , ArchiveFilter (..)
                                   , ArchiveFormat (..)
                                   , ArchiveCapabilities (..)
                                   , ReadDiskFlags (..)
                                   , TimeFlag (..)
                                   , EntryACL (..)
                                   -- * libarchive types
                                   , LaInt64
                                   , LaSSize
                                   ) where
import qualified Foreign.C.Types as C2HSImp



import           Control.DeepSeq    (NFData)
import           Control.Exception  (Exception)
import           Data.Bits          (Bits (..))
import           Data.Semigroup     (Semigroup (..))
import           Foreign.C.String   (CString)
import           Foreign.C.Types    (CInt, CSize)
import           Foreign.Ptr        (Ptr)
import           GHC.Generics       (Generic)




type LaInt64 = (C2HSImp.CLong)
{-# LINE 51 "src/Codec/Archive/Types/Foreign.chs" #-}

type LaSSize = (C2HSImp.CLong)
{-# LINE 52 "src/Codec/Archive/Types/Foreign.chs" #-}


data ArchiveResult = ArchiveFatal
                   | ArchiveFailed
                   | ArchiveWarn
                   | ArchiveRetry
                   | ArchiveOk
                   | ArchiveEOF
  deriving (Eq,Show,Generic,NFData,Exception)
instance Enum ArchiveResult where
  succ :: ArchiveResult -> ArchiveResult
succ ArchiveResult
ArchiveFatal = ArchiveResult
ArchiveFailed
  succ ArchiveResult
ArchiveFailed = ArchiveResult
ArchiveWarn
  succ ArchiveResult
ArchiveWarn = ArchiveResult
ArchiveRetry
  succ ArchiveResult
ArchiveRetry = ArchiveResult
ArchiveOk
  succ ArchiveResult
ArchiveOk = ArchiveResult
ArchiveEOF
  succ ArchiveResult
ArchiveEOF = String -> ArchiveResult
forall a. HasCallStack => String -> a
error String
"ArchiveResult.succ: ArchiveEOF has no successor"

  pred :: ArchiveResult -> ArchiveResult
pred ArchiveResult
ArchiveFailed = ArchiveResult
ArchiveFatal
  pred ArchiveResult
ArchiveWarn = ArchiveResult
ArchiveFailed
  pred ArchiveResult
ArchiveRetry = ArchiveResult
ArchiveWarn
  pred ArchiveResult
ArchiveOk = ArchiveResult
ArchiveRetry
  pred ArchiveResult
ArchiveEOF = ArchiveResult
ArchiveOk
  pred ArchiveResult
ArchiveFatal = String -> ArchiveResult
forall a. HasCallStack => String -> a
error String
"ArchiveResult.pred: ArchiveFatal has no predecessor"

  enumFromTo :: ArchiveResult -> ArchiveResult -> [ArchiveResult]
enumFromTo ArchiveResult
from ArchiveResult
to = ArchiveResult -> [ArchiveResult]
forall t. Enum t => t -> [t]
go ArchiveResult
from
    where
      end :: Int
end = ArchiveResult -> Int
forall a. Enum a => a -> Int
fromEnum ArchiveResult
to
      go :: t -> [t]
go t
v = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (t -> Int
forall a. Enum a => a -> Int
fromEnum t
v) Int
end of
                 Ordering
LT -> t
v t -> [t] -> [t]
forall a. a -> [a] -> [a]
: t -> [t]
go (t -> t
forall a. Enum a => a -> a
succ t
v)
                 Ordering
EQ -> [t
v]
                 Ordering
GT -> []

  enumFrom :: ArchiveResult -> [ArchiveResult]
enumFrom ArchiveResult
from = ArchiveResult -> ArchiveResult -> [ArchiveResult]
forall a. Enum a => a -> a -> [a]
enumFromTo ArchiveResult
from ArchiveResult
ArchiveEOF

  fromEnum :: ArchiveResult -> Int
fromEnum ArchiveResult
ArchiveFatal = (-Int
30)
  fromEnum ArchiveResult
ArchiveFailed = (-Int
25)
  fromEnum ArchiveResult
ArchiveWarn = (-Int
20)
  fromEnum ArchiveResult
ArchiveRetry = (-Int
10)
  fromEnum ArchiveResult
ArchiveOk = Int
0
  fromEnum ArchiveResult
ArchiveEOF = Int
1

  toEnum (-30) = ArchiveFatal
  toEnum (-25) = ArchiveFailed
  toEnum (-20) = ArchiveResult
ArchiveWarn
  toEnum (-10) = ArchiveResult
ArchiveRetry
  toEnum Int
0 = ArchiveResult
ArchiveOk
  toEnum Int
1 = ArchiveResult
ArchiveEOF
  toEnum Int
unmatched = String -> ArchiveResult
forall a. HasCallStack => String -> a
error (String
"ArchiveResult.toEnum: Cannot match " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
unmatched)

{-# LINE 61 "src/Codec/Archive/Types/Foreign.chs" #-}


data FileType = FtFifo
              | FtCharacter
              | FtDirectory
              | FtBlock
              | FtRegular
              | FtLink
              | FtSocket
  deriving (Eq,Ord)
instance Enum FileType where
  succ FtFifo = FtCharacter
  succ FtCharacter = FtDirectory
  succ FtDirectory = FtBlock
  succ FtBlock = FtRegular
  succ FtRegular = FtLink
  succ FtLink = FtSocket
  succ FtSocket = error "FileType.succ: FtSocket has no successor"

  pred FtCharacter = FtFifo
  pred FtDirectory = FtCharacter
  pred FtBlock = FtDirectory
  pred FtRegular = FtBlock
  pred FtLink = FtRegular
  pred FtSocket = FtLink
  pred FtFifo = error "FileType.pred: FtFifo has no predecessor"

  enumFromTo from to = go from
    where
      end = fromEnum to
      go v = case compare (fromEnum v) end of
                 LT -> v : go (succ v)
                 EQ -> [v]
                 GT -> []

  enumFrom from = enumFromTo from FtSocket

  fromEnum FtFifo = 4096
  fromEnum FtCharacter = 8192
  fromEnum FtDirectory = 16384
  fromEnum FtBlock = 24576
  fromEnum FtRegular = 32768
  fromEnum FtLink = 40960
  fromEnum FtSocket = 49152

  toEnum 4096 = FtFifo
  toEnum 8192 = FtCharacter
  toEnum 16384 = FtDirectory
  toEnum 24576 = FtBlock
  toEnum 32768 = FtRegular
  toEnum 40960 = FtLink
  toEnum 49152 = FtSocket
  toEnum unmatched = error ("FileType.toEnum: Cannot match " ++ show unmatched)

{-# LINE 71 "src/Codec/Archive/Types/Foreign.chs" #-}


data Symlink = SymlinkUndefined
             | SymlinkFile
             | SymlinkDirectory
  deriving (Show,Eq,Ord)
instance Enum Symlink where
  succ SymlinkUndefined = SymlinkFile
  succ SymlinkFile = SymlinkDirectory
  succ SymlinkDirectory = error "Symlink.succ: SymlinkDirectory has no successor"

  pred SymlinkFile = SymlinkUndefined
  pred SymlinkDirectory = SymlinkFile
  pred SymlinkUndefined = error "Symlink.pred: SymlinkUndefined has no predecessor"

  enumFromTo from to = go from
    where
      end = fromEnum to
      go v = case compare (fromEnum v) end of
                 LT -> v : go (succ v)
                 EQ -> [v]
                 GT -> []

  enumFrom from = enumFromTo from SymlinkDirectory

  fromEnum SymlinkUndefined = 0
  fromEnum SymlinkFile = 1
  fromEnum SymlinkDirectory = 2

  toEnum 0 = SymlinkUndefined
  toEnum 1 = SymlinkFile
  toEnum 2 = SymlinkDirectory
  toEnum unmatched = error ("Symlink.toEnum: Cannot match " ++ show unmatched)

{-# LINE 77 "src/Codec/Archive/Types/Foreign.chs" #-}


data ArchiveFilter = ArchiveFilterNone
                   | ArchiveFilterGzip
                   | ArchiveFilterBzip2
                   | ArchiveFilterCompress
                   | ArchiveFilterProgram
                   | ArchiveFilterLzma
                   | ArchiveFilterXz
                   | ArchiveFilterUu
                   | ArchiveFilterRpm
                   | ArchiveFilterLzip
                   | ArchiveFilterLrzip
                   | ArchiveFilterLzop
                   | ArchiveFilterGrzip
                   | ArchiveFilterLz4
                   | ArchiveFilterZstd
instance Enum ArchiveFilter where
  succ ArchiveFilterNone = ArchiveFilterGzip
  succ ArchiveFilterGzip = ArchiveFilterBzip2
  succ ArchiveFilterBzip2 = ArchiveFilterCompress
  succ ArchiveFilterCompress = ArchiveFilterProgram
  succ ArchiveFilterProgram = ArchiveFilterLzma
  succ ArchiveFilterLzma = ArchiveFilterXz
  succ ArchiveFilterXz = ArchiveFilterUu
  succ ArchiveFilterUu = ArchiveFilterRpm
  succ ArchiveFilterRpm = ArchiveFilterLzip
  succ ArchiveFilterLzip = ArchiveFilterLrzip
  succ ArchiveFilterLrzip = ArchiveFilterLzop
  succ ArchiveFilterLzop = ArchiveFilterGrzip
  succ ArchiveFilterGrzip = ArchiveFilterLz4
  succ ArchiveFilterLz4 = ArchiveFilterZstd
  succ ArchiveFilterZstd = error "ArchiveFilter.succ: ArchiveFilterZstd has no successor"

  pred ArchiveFilterGzip = ArchiveFilterNone
  pred ArchiveFilterBzip2 = ArchiveFilterGzip
  pred ArchiveFilterCompress = ArchiveFilterBzip2
  pred ArchiveFilterProgram = ArchiveFilterCompress
  pred ArchiveFilterLzma = ArchiveFilterProgram
  pred ArchiveFilterXz = ArchiveFilterLzma
  pred ArchiveFilterUu = ArchiveFilterXz
  pred ArchiveFilterRpm = ArchiveFilterUu
  pred ArchiveFilterLzip = ArchiveFilterRpm
  pred ArchiveFilterLrzip = ArchiveFilterLzip
  pred ArchiveFilterLzop = ArchiveFilterLrzip
  pred ArchiveFilterGrzip = ArchiveFilterLzop
  pred ArchiveFilterLz4 = ArchiveFilterGrzip
  pred ArchiveFilterZstd = ArchiveFilterLz4
  pred ArchiveFilterNone = error "ArchiveFilter.pred: ArchiveFilterNone has no predecessor"

  enumFromTo :: ArchiveFilter -> ArchiveFilter -> [ArchiveFilter]
enumFromTo ArchiveFilter
from ArchiveFilter
to = ArchiveFilter -> [ArchiveFilter]
forall t. Enum t => t -> [t]
go ArchiveFilter
from
    where
      end :: Int
end = ArchiveFilter -> Int
forall a. Enum a => a -> Int
fromEnum ArchiveFilter
to
      go :: t -> [t]
go t
v = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (t -> Int
forall a. Enum a => a -> Int
fromEnum t
v) Int
end of
                 Ordering
LT -> t
v t -> [t] -> [t]
forall a. a -> [a] -> [a]
: t -> [t]
go (t -> t
forall a. Enum a => a -> a
succ t
v)
                 Ordering
EQ -> [t
v]
                 Ordering
GT -> []

  enumFrom :: ArchiveFilter -> [ArchiveFilter]
enumFrom ArchiveFilter
from = ArchiveFilter -> ArchiveFilter -> [ArchiveFilter]
forall a. Enum a => a -> a -> [a]
enumFromTo ArchiveFilter
from ArchiveFilter
ArchiveFilterZstd

  fromEnum :: ArchiveFilter -> Int
fromEnum ArchiveFilter
ArchiveFilterNone = Int
0
  fromEnum ArchiveFilterGzip = Int
1
  fromEnum ArchiveFilterBzip2 = Int
2
  fromEnum ArchiveFilter
ArchiveFilterCompress = Int
3
  fromEnum ArchiveFilterProgram = Int
4
  fromEnum ArchiveFilterLzma = Int
5
  fromEnum ArchiveFilter
ArchiveFilterXz = Int
6
  fromEnum ArchiveFilterUu = Int
7
  fromEnum ArchiveFilterRpm = 8
  fromEnum ArchiveFilterLzip = Int
9
  fromEnum ArchiveFilterLrzip = Int
10
  fromEnum ArchiveFilterLzop = Int
11
  fromEnum ArchiveFilterGrzip = Int
12
  fromEnum ArchiveFilterLz4 = Int
13
  fromEnum ArchiveFilter
ArchiveFilterZstd = Int
14

  toEnum 0 = ArchiveFilterNone
  toEnum 1 = ArchiveFilterGzip
  toEnum 2 = ArchiveFilterBzip2
  toEnum 3 = ArchiveFilterCompress
  toEnum 4 = ArchiveFilterProgram
  toEnum 5 = ArchiveFilterLzma
  toEnum 6 = ArchiveFilterXz
  toEnum 7 = ArchiveFilterUu
  toEnum 8 = ArchiveFilterRpm
  toEnum 9 = ArchiveFilterLzip
  toEnum 10 = ArchiveFilterLrzip
  toEnum 11 = ArchiveFilterLzop
  toEnum 12 = ArchiveFilterGrzip
  toEnum 13 = ArchiveFilterLz4
  toEnum 14 = ArchiveFilterZstd
  toEnum unmatched = error ("ArchiveFilter.toEnum: Cannot match " ++ show unmatched)

{-# LINE 95 "src/Codec/Archive/Types/Foreign.chs" #-}


data ArchiveFormat = ArchiveFormatCpio
                   | ArchiveFormatCpioPosix
                   | ArchiveFormatCpioBinLe
                   | ArchiveFormatCpioBinBe
                   | ArchiveFormatCpioSvr4Nocrc
                   | ArchiveFormatCpioSvr4Crc
                   | ArchiveFormatCpioAfioLarge
                   | ArchiveFormatShar
                   | ArchiveFormatSharBase
                   | ArchiveFormatSharDump
                   | ArchiveFormatTar
                   | ArchiveFormatTarUstar
                   | ArchiveFormatTarPaxInterchange
                   | ArchiveFormatTarPaxRestricted
                   | ArchiveFormatTarGnutar
                   | ArchiveFormatIso9660
                   | ArchiveFormatIso9660Rockridge
                   | ArchiveFormatZip
                   | ArchiveFormatEmpty
                   | ArchiveFormatAr
                   | ArchiveFormatArGnu
                   | ArchiveFormatArBsd
                   | ArchiveFormatMtree
                   | ArchiveFormatRaw
                   | ArchiveFormatXar
                   | ArchiveFormatLha
                   | ArchiveFormatCab
                   | ArchiveFormatRar
                   | ArchiveFormat7zip
                   | ArchiveFormatWarc
                   | ArchiveFormatRarV5
  deriving (Eq)
instance Enum ArchiveFormat where
  succ ArchiveFormatCpio = ArchiveFormatCpioPosix
  succ ArchiveFormatCpioPosix = ArchiveFormatCpioBinLe
  succ ArchiveFormatCpioBinLe = ArchiveFormatCpioBinBe
  succ ArchiveFormatCpioBinBe = ArchiveFormatCpioSvr4Nocrc
  succ ArchiveFormatCpioSvr4Nocrc = ArchiveFormatCpioSvr4Crc
  succ ArchiveFormatCpioSvr4Crc = ArchiveFormatCpioAfioLarge
  succ ArchiveFormatCpioAfioLarge = ArchiveFormatShar
  succ ArchiveFormatShar = ArchiveFormatSharBase
  succ ArchiveFormatSharBase = ArchiveFormatSharDump
  succ ArchiveFormatSharDump = ArchiveFormatTar
  succ ArchiveFormatTar = ArchiveFormatTarUstar
  succ ArchiveFormatTarUstar = ArchiveFormatTarPaxInterchange
  succ ArchiveFormatTarPaxInterchange = ArchiveFormatTarPaxRestricted
  succ ArchiveFormatTarPaxRestricted = ArchiveFormatTarGnutar
  succ ArchiveFormatTarGnutar = ArchiveFormatIso9660
  succ ArchiveFormatIso9660 = ArchiveFormatIso9660Rockridge
  succ ArchiveFormatIso9660Rockridge = ArchiveFormatZip
  succ ArchiveFormatZip = ArchiveFormatEmpty
  succ ArchiveFormatEmpty = ArchiveFormatAr
  succ ArchiveFormatAr = ArchiveFormatArGnu
  succ ArchiveFormatArGnu = ArchiveFormatArBsd
  succ ArchiveFormatArBsd = ArchiveFormatMtree
  succ ArchiveFormatMtree = ArchiveFormatRaw
  succ ArchiveFormatRaw = ArchiveFormatXar
  succ ArchiveFormatXar = ArchiveFormatLha
  succ ArchiveFormatLha = ArchiveFormatCab
  succ ArchiveFormatCab = ArchiveFormatRar
  succ ArchiveFormatRar = ArchiveFormat7zip
  succ ArchiveFormat7zip = ArchiveFormatWarc
  succ ArchiveFormatWarc = ArchiveFormatRarV5
  succ ArchiveFormatRarV5 = error "ArchiveFormat.succ: ArchiveFormatRarV5 has no successor"

  pred ArchiveFormatCpioPosix = ArchiveFormatCpio
  pred ArchiveFormatCpioBinLe = ArchiveFormatCpioPosix
  pred ArchiveFormatCpioBinBe = ArchiveFormatCpioBinLe
  pred ArchiveFormatCpioSvr4Nocrc = ArchiveFormatCpioBinBe
  pred ArchiveFormatCpioSvr4Crc = ArchiveFormatCpioSvr4Nocrc
  pred ArchiveFormatCpioAfioLarge = ArchiveFormatCpioSvr4Crc
  pred ArchiveFormatShar = ArchiveFormatCpioAfioLarge
  pred ArchiveFormatSharBase = ArchiveFormatShar
  pred ArchiveFormatSharDump = ArchiveFormatSharBase
  pred ArchiveFormatTar = ArchiveFormatSharDump
  pred ArchiveFormatTarUstar = ArchiveFormatTar
  pred ArchiveFormatTarPaxInterchange = ArchiveFormatTarUstar
  pred ArchiveFormatTarPaxRestricted = ArchiveFormatTarPaxInterchange
  pred ArchiveFormatTarGnutar = ArchiveFormatTarPaxRestricted
  pred ArchiveFormatIso9660 = ArchiveFormatTarGnutar
  pred ArchiveFormatIso9660Rockridge = ArchiveFormatIso9660
  pred ArchiveFormatZip = ArchiveFormatIso9660Rockridge
  pred ArchiveFormatEmpty = ArchiveFormatZip
  pred ArchiveFormatAr = ArchiveFormatEmpty
  pred ArchiveFormatArGnu = ArchiveFormatAr
  pred ArchiveFormatArBsd = ArchiveFormatArGnu
  pred ArchiveFormatMtree = ArchiveFormatArBsd
  pred ArchiveFormatRaw = ArchiveFormatMtree
  pred ArchiveFormatXar = ArchiveFormatRaw
  pred ArchiveFormatLha = ArchiveFormatXar
  pred ArchiveFormatCab = ArchiveFormatLha
  pred ArchiveFormatRar = ArchiveFormatCab
  pred ArchiveFormat7zip = ArchiveFormatRar
  pred ArchiveFormatWarc = ArchiveFormat7zip
  pred ArchiveFormatRarV5 = ArchiveFormatWarc
  pred ArchiveFormatCpio = error "ArchiveFormat.pred: ArchiveFormatCpio has no predecessor"

  enumFromTo :: ArchiveFormat -> ArchiveFormat -> [ArchiveFormat]
enumFromTo ArchiveFormat
from ArchiveFormat
to = ArchiveFormat -> [ArchiveFormat]
forall t. Enum t => t -> [t]
go ArchiveFormat
from
    where
      end :: Int
end = ArchiveFormat -> Int
forall a. Enum a => a -> Int
fromEnum ArchiveFormat
to
      go :: t -> [t]
go t
v = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (t -> Int
forall a. Enum a => a -> Int
fromEnum t
v) Int
end of
                 Ordering
LT -> t
v t -> [t] -> [t]
forall a. a -> [a] -> [a]
: t -> [t]
go (t -> t
forall a. Enum a => a -> a
succ t
v)
                 Ordering
EQ -> [t
v]
                 Ordering
GT -> []

  enumFrom :: ArchiveFormat -> [ArchiveFormat]
enumFrom ArchiveFormat
from = ArchiveFormat -> ArchiveFormat -> [ArchiveFormat]
forall a. Enum a => a -> a -> [a]
enumFromTo ArchiveFormat
from ArchiveFormat
ArchiveFormatRarV5

  fromEnum :: ArchiveFormat -> Int
fromEnum ArchiveFormat
ArchiveFormatCpio = Int
65536
  fromEnum ArchiveFormat
ArchiveFormatCpioPosix = Int
65537
  fromEnum ArchiveFormat
ArchiveFormatCpioBinLe = Int
65538
  fromEnum ArchiveFormat
ArchiveFormatCpioBinBe = Int
65539
  fromEnum ArchiveFormat
ArchiveFormatCpioSvr4Nocrc = Int
65540
  fromEnum ArchiveFormat
ArchiveFormatCpioSvr4Crc = Int
65541
  fromEnum ArchiveFormat
ArchiveFormatCpioAfioLarge = Int
65542
  fromEnum ArchiveFormat
ArchiveFormatShar = Int
131072
  fromEnum ArchiveFormat
ArchiveFormatSharBase = Int
131073
  fromEnum ArchiveFormat
ArchiveFormatSharDump = Int
131074
  fromEnum ArchiveFormat
ArchiveFormatTar = Int
196608
  fromEnum ArchiveFormat
ArchiveFormatTarUstar = Int
196609
  fromEnum ArchiveFormat
ArchiveFormatTarPaxInterchange = Int
196610
  fromEnum ArchiveFormat
ArchiveFormatTarPaxRestricted = Int
196611
  fromEnum ArchiveFormat
ArchiveFormatTarGnutar = Int
196612
  fromEnum ArchiveFormat
ArchiveFormatIso9660 = Int
262144
  fromEnum ArchiveFormat
ArchiveFormatIso9660Rockridge = Int
262145
  fromEnum ArchiveFormat
ArchiveFormatZip = Int
327680
  fromEnum ArchiveFormat
ArchiveFormatEmpty = Int
393216
  fromEnum ArchiveFormat
ArchiveFormatAr = Int
458752
  fromEnum ArchiveFormat
ArchiveFormatArGnu = Int
458753
  fromEnum ArchiveFormat
ArchiveFormatArBsd = Int
458754
  fromEnum ArchiveFormat
ArchiveFormatMtree = Int
524288
  fromEnum ArchiveFormat
ArchiveFormatRaw = Int
589824
  fromEnum ArchiveFormat
ArchiveFormatXar = Int
655360
  fromEnum ArchiveFormat
ArchiveFormatLha = Int
720896
  fromEnum ArchiveFormat
ArchiveFormatCab = Int
786432
  fromEnum ArchiveFormat
ArchiveFormatRar = Int
851968
  fromEnum ArchiveFormat
ArchiveFormat7zip = Int
917504
  fromEnum ArchiveFormat
ArchiveFormatWarc = Int
983040
  fromEnum ArchiveFormat
ArchiveFormatRarV5 = Int
1048576

  toEnum :: Int -> ArchiveFormat
toEnum Int
65536 = ArchiveFormat
ArchiveFormatCpio
  toEnum Int
65537 = ArchiveFormat
ArchiveFormatCpioPosix
  toEnum Int
65538 = ArchiveFormat
ArchiveFormatCpioBinLe
  toEnum Int
65539 = ArchiveFormat
ArchiveFormatCpioBinBe
  toEnum Int
65540 = ArchiveFormat
ArchiveFormatCpioSvr4Nocrc
  toEnum Int
65541 = ArchiveFormat
ArchiveFormatCpioSvr4Crc
  toEnum Int
65542 = ArchiveFormat
ArchiveFormatCpioAfioLarge
  toEnum Int
131072 = ArchiveFormat
ArchiveFormatShar
  toEnum Int
131073 = ArchiveFormat
ArchiveFormatSharBase
  toEnum Int
131074 = ArchiveFormat
ArchiveFormatSharDump
  toEnum Int
196608 = ArchiveFormat
ArchiveFormatTar
  toEnum Int
196609 = ArchiveFormat
ArchiveFormatTarUstar
  toEnum Int
196610 = ArchiveFormat
ArchiveFormatTarPaxInterchange
  toEnum Int
196611 = ArchiveFormat
ArchiveFormatTarPaxRestricted
  toEnum Int
196612 = ArchiveFormat
ArchiveFormatTarGnutar
  toEnum Int
262144 = ArchiveFormat
ArchiveFormatIso9660
  toEnum Int
262145 = ArchiveFormat
ArchiveFormatIso9660Rockridge
  toEnum Int
327680 = ArchiveFormat
ArchiveFormatZip
  toEnum Int
393216 = ArchiveFormat
ArchiveFormatEmpty
  toEnum Int
458752 = ArchiveFormat
ArchiveFormatAr
  toEnum Int
458753 = ArchiveFormat
ArchiveFormatArGnu
  toEnum Int
458754 = ArchiveFormat
ArchiveFormatArBsd
  toEnum Int
524288 = ArchiveFormat
ArchiveFormatMtree
  toEnum Int
589824 = ArchiveFormat
ArchiveFormatRaw
  toEnum Int
655360 = ArchiveFormat
ArchiveFormatXar
  toEnum Int
720896 = ArchiveFormat
ArchiveFormatLha
  toEnum Int
786432 = ArchiveFormat
ArchiveFormatCab
  toEnum Int
851968 = ArchiveFormat
ArchiveFormatRar
  toEnum Int
917504 = ArchiveFormat
ArchiveFormat7zip
  toEnum Int
983040 = ArchiveFormat
ArchiveFormatWarc
  toEnum Int
1048576 = ArchiveFormat
ArchiveFormatRarV5
  toEnum Int
unmatched = String -> ArchiveFormat
forall a. HasCallStack => String -> a
error (String
"ArchiveFormat.toEnum: Cannot match " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
unmatched)

{-# LINE 129 "src/Codec/Archive/Types/Foreign.chs" #-}


data ArchiveEntryDigest = ArchiveEntryDigestMD5
                        | ArchiveEntryDigestRMD160
                        | ArchiveEntryDigestSHA1
                        | ArchiveEntryDigestSHA256
                        | ArchiveEntryDigestSHA384
                        | ArchiveEntryDigestSHA512
instance Enum ArchiveEntryDigest where
  succ ArchiveEntryDigestMD5 = ArchiveEntryDigestRMD160
  succ ArchiveEntryDigestRMD160 = ArchiveEntryDigestSHA1
  succ ArchiveEntryDigestSHA1 = ArchiveEntryDigestSHA256
  succ ArchiveEntryDigestSHA256 = ArchiveEntryDigestSHA384
  succ ArchiveEntryDigestSHA384 = ArchiveEntryDigestSHA512
  succ ArchiveEntryDigestSHA512 = error "ArchiveEntryDigest.succ: ArchiveEntryDigestSHA512 has no successor"

  pred ArchiveEntryDigestRMD160 = ArchiveEntryDigestMD5
  pred ArchiveEntryDigestSHA1 = ArchiveEntryDigestRMD160
  pred ArchiveEntryDigestSHA256 = ArchiveEntryDigestSHA1
  pred ArchiveEntryDigestSHA384 = ArchiveEntryDigestSHA256
  pred ArchiveEntryDigestSHA512 = ArchiveEntryDigestSHA384
  pred ArchiveEntryDigestMD5 = error "ArchiveEntryDigest.pred: ArchiveEntryDigestMD5 has no predecessor"

  enumFromTo from to = go from
    where
      end = fromEnum to
      go v = case compare (fromEnum v) end of
                 LT -> v : go (succ v)
                 EQ -> [v]
                 GT -> []

  enumFrom from = enumFromTo from ArchiveEntryDigestSHA512

  fromEnum ArchiveEntryDigestMD5 = 1
  fromEnum ArchiveEntryDigestRMD160 = 2
  fromEnum ArchiveEntryDigestSHA1 = 3
  fromEnum ArchiveEntryDigestSHA256 = 4
  fromEnum ArchiveEntryDigestSHA384 = 5
  fromEnum ArchiveEntryDigestSHA512 = 6

  toEnum 1 = ArchiveEntryDigestMD5
  toEnum 2 = ArchiveEntryDigestRMD160
  toEnum 3 = ArchiveEntryDigestSHA1
  toEnum 4 = ArchiveEntryDigestSHA256
  toEnum 5 = ArchiveEntryDigestSHA384
  toEnum 6 = ArchiveEntryDigestSHA512
  toEnum unmatched = error ("ArchiveEntryDigest.toEnum: Cannot match " ++ show unmatched)

{-# LINE 138 "src/Codec/Archive/Types/Foreign.chs" #-}


-- | Abstract type
data Archive

-- | Abstract type
data ArchiveEntry

data Stat

data LinkResolver

type ArchiveReadCallback a b = Ptr Archive -> Ptr a -> Ptr (Ptr b) -> IO LaSSize
type ArchiveSkipCallback a = Ptr Archive -> Ptr a -> LaInt64 -> IO LaInt64
type ArchiveSeekCallback a = Ptr Archive -> Ptr a -> LaInt64 -> CInt -> IO LaInt64
type ArchiveWriteCallback a b = Ptr Archive -> Ptr a -> Ptr b -> CSize -> IO LaSSize
type ArchiveOpenCallbackRaw a = Ptr Archive -> Ptr a -> IO CInt
type ArchiveCloseCallbackRaw a = Ptr Archive -> Ptr a -> IO CInt
type ArchiveSwitchCallbackRaw a b = Ptr Archive -> Ptr a -> Ptr b -> IO CInt
type ArchivePassphraseCallback a = Ptr Archive -> Ptr a -> IO CString
type ArchiveFreeCallbackRaw a = Ptr Archive -> Ptr a -> IO CInt

newtype Flags = Flags CInt

newtype ReadDiskFlags = ReadDiskFlags CInt

newtype TimeFlag = TimeFlag CInt

newtype EntryACL = EntryACL CInt

newtype ArchiveCapabilities = ArchiveCapabilities CInt
    deriving (Eq)

instance Semigroup ArchiveCapabilities where
    (<>) (ArchiveCapabilities x) (ArchiveCapabilities y) = ArchiveCapabilities (x .|. y)

instance Monoid ArchiveCapabilities where
    mempty = ArchiveCapabilities 0
    mappend = (<>)

instance Semigroup ReadDiskFlags where
    (<>) (ReadDiskFlags x) (ReadDiskFlags y) = ReadDiskFlags (x .|. y)

instance Semigroup Flags where
    (<>) (Flags x) (Flags y) = Flags (x .|. y)

instance Monoid Flags where
    mempty = Flags 0
    mappend = (<>)

instance Semigroup EntryACL where
    (<>) (EntryACL x) (EntryACL y) = EntryACL (x .|. y)

-- TODO: `has` function for EntryACL