Move ArchiveResult into GHCup.Utils.Tar.Types
So a module that wants to import ArchiveResult doesn't have to worry about CPP.
This commit is contained in:
parent
2ece023c0f
commit
87ec8c756f
@ -136,6 +136,7 @@ library
|
||||
GHCup.Utils
|
||||
GHCup.Utils.Dirs
|
||||
GHCup.Utils.Tar
|
||||
GHCup.Utils.Tar.Types
|
||||
GHCup.Version
|
||||
|
||||
hs-source-dirs: lib
|
||||
|
@ -21,9 +21,6 @@ module GHCup.Errors where
|
||||
|
||||
import GHCup.Types
|
||||
|
||||
#if !defined(TAR)
|
||||
import Codec.Archive
|
||||
#endif
|
||||
import Control.Exception.Safe
|
||||
import Data.ByteString ( ByteString )
|
||||
import Data.CaseInsensitive ( CI )
|
||||
|
@ -29,14 +29,10 @@ module GHCup.Types
|
||||
where
|
||||
|
||||
import GHCup.Types.Stack ( SetupInfo )
|
||||
import GHCup.Utils.Tar.Types ( ArchiveResult(..) )
|
||||
import {-# SOURCE #-} GHCup.Utils.Dirs ( fromGHCupPath, GHCupPath )
|
||||
|
||||
import Control.DeepSeq ( NFData, rnf )
|
||||
#if defined(TAR)
|
||||
import Control.Exception ( Exception )
|
||||
#else
|
||||
import Codec.Archive ( ArchiveResult(..) )
|
||||
#endif
|
||||
import Data.Map.Strict ( Map )
|
||||
import Data.List.NonEmpty ( NonEmpty (..) )
|
||||
import Data.Time.Calendar ( Day )
|
||||
@ -781,19 +777,3 @@ instance Pretty ToolVersion where
|
||||
data BuildSystem = Hadrian
|
||||
| Make
|
||||
deriving (Show, Eq)
|
||||
|
||||
#if defined(TAR)
|
||||
data ArchiveResult = ArchiveFatal
|
||||
| ArchiveFailed
|
||||
| ArchiveWarn
|
||||
| ArchiveRetry
|
||||
| ArchiveOk
|
||||
| ArchiveEOF
|
||||
deriving (Eq, Show, GHC.Generic)
|
||||
|
||||
instance NFData ArchiveResult
|
||||
|
||||
instance Exception ArchiveResult
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -14,7 +14,7 @@ Portability : portable
|
||||
-}
|
||||
module GHCup.Utils.Tar where
|
||||
|
||||
import GHCup.Types
|
||||
import GHCup.Utils.Tar.Types ( ArchiveResult(..) )
|
||||
import GHCup.Errors
|
||||
import GHCup.Prelude
|
||||
import GHCup.Prelude.Logger.Internal
|
||||
@ -31,7 +31,9 @@ import Codec.Archive.Zip
|
||||
import qualified Codec.Archive.Tar as Tar
|
||||
import qualified Codec.Archive.Tar.Entry as Tar
|
||||
#else
|
||||
import Codec.Archive hiding ( Directory )
|
||||
import Codec.Archive hiding ( Directory
|
||||
, ArchiveResult -- imported from "GHCup.Utils.Tar.Types"
|
||||
)
|
||||
#endif
|
||||
|
||||
import qualified Codec.Compression.BZip as BZip
|
||||
|
31
lib/GHCup/Utils/Tar/Types.hs
Normal file
31
lib/GHCup/Utils/Tar/Types.hs
Normal file
@ -0,0 +1,31 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
module GHCup.Utils.Tar.Types
|
||||
( ArchiveResult(..)
|
||||
)
|
||||
where
|
||||
|
||||
#if defined(TAR)
|
||||
|
||||
import Control.Exception ( Exception )
|
||||
import Control.DeepSeq ( NFData )
|
||||
import qualified GHC.Generics as GHC
|
||||
|
||||
data ArchiveResult = ArchiveFatal
|
||||
| ArchiveFailed
|
||||
| ArchiveWarn
|
||||
| ArchiveRetry
|
||||
| ArchiveOk
|
||||
| ArchiveEOF
|
||||
deriving (Eq, Show, GHC.Generic)
|
||||
|
||||
instance NFData ArchiveResult
|
||||
|
||||
instance Exception ArchiveResult
|
||||
|
||||
#else
|
||||
|
||||
import Codec.Archive ( ArchiveResult(..) )
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user