77 lines
1.9 KiB
Haskell
77 lines
1.9 KiB
Haskell
{-# LANGUAGE DeriveGeneric #-}
|
|
|
|
module GHCup.Types where
|
|
|
|
import Data.Map.Strict ( Map )
|
|
import Network.URL
|
|
import qualified GHC.Generics as GHC
|
|
import Data.Versions
|
|
import HPath
|
|
import System.Posix.Types
|
|
|
|
data DownloadDestination = DPath {
|
|
dDestDir :: Path Abs
|
|
, dFileName :: Maybe (Path Fn)
|
|
} |
|
|
Fd {
|
|
dFd :: Fd
|
|
}
|
|
|
|
data Tool = GHC
|
|
| Cabal
|
|
| Stack
|
|
deriving (Eq, GHC.Generic, Ord, Show)
|
|
|
|
data ToolRequest = ToolRequest {
|
|
_tool :: Tool
|
|
, _toolVersion :: Version
|
|
} deriving (Eq, Show)
|
|
|
|
data Architecture = A_64
|
|
| A_32
|
|
deriving (Eq, GHC.Generic, Ord, Show)
|
|
|
|
data LinuxDistro = Debian
|
|
| Ubuntu
|
|
| Mint
|
|
| Fedora
|
|
| CentOS
|
|
| RedHat
|
|
| Alpine
|
|
-- rolling
|
|
| Gentoo
|
|
| Exherbo
|
|
-- not known
|
|
| UnknownLinux
|
|
-- ^ must exit
|
|
deriving (Eq, GHC.Generic, Ord, Show)
|
|
|
|
data Platform = Linux LinuxDistro
|
|
-- ^ must exit
|
|
| Darwin
|
|
-- ^ must exit
|
|
| FreeBSD
|
|
deriving (Eq, GHC.Generic, Ord, Show)
|
|
|
|
data PlatformResult = PlatformResult {
|
|
_platform :: Platform
|
|
, _distroVersion :: Maybe Versioning
|
|
} deriving (Eq, Show)
|
|
|
|
data PlatformRequest = PlatformRequest {
|
|
_rArch :: Architecture
|
|
, _rPlatform :: Platform
|
|
, _rVersion :: Maybe Versioning
|
|
} deriving (Eq, Show)
|
|
|
|
type PlatformVersionSpec = Map (Maybe Versioning) URL
|
|
type PlatformSpec = Map Platform PlatformVersionSpec
|
|
type ArchitectureSpec = Map Architecture PlatformSpec
|
|
type ToolVersionSpec = Map Version ArchitectureSpec
|
|
type AvailableDownloads = Map Tool ToolVersionSpec
|
|
|
|
|
|
data URLSource = GHCupURL
|
|
| OwnSource URL
|
|
| OwnSpec AvailableDownloads
|