ghcup-hs/lib/GHCup/Types.hs

68 lines
1.7 KiB
Haskell
Raw Normal View History

2020-01-14 21:55:34 +00:00
{-# LANGUAGE DeriveGeneric #-}
module GHCup.Types where
2020-01-16 22:27:38 +00:00
import Data.Map.Strict ( Map )
import Network.URL
import qualified GHC.Generics as GHC
import Data.Versions
2020-01-14 21:55:34 +00:00
data Tool = GHC
| Cabal
| Stack
2020-01-17 00:48:42 +00:00
deriving (Eq, GHC.Generic, Ord, Show)
2020-01-14 21:55:34 +00:00
2020-01-16 22:27:38 +00:00
data ToolRequest = ToolRequest {
_tool :: Tool
, _toolVersion :: Version
} deriving (Eq, Show)
2020-01-14 21:55:34 +00:00
data Architecture = A_64
| A_32
2020-01-17 00:48:42 +00:00
deriving (Eq, GHC.Generic, Ord, Show)
2020-01-14 21:55:34 +00:00
2020-01-16 22:27:38 +00:00
data LinuxDistro = Debian
| Ubuntu
| Mint
| Fedora
| CentOS
| RedHat
| Alpine
-- rolling
| Gentoo
| Exherbo
2020-01-14 21:55:34 +00:00
-- not known
| UnknownLinux
-- ^ must exit
deriving (Eq, GHC.Generic, Ord, Show)
data Platform = Linux LinuxDistro
-- ^ must exit
| Darwin
-- ^ must exit
2020-01-16 22:27:38 +00:00
| FreeBSD
2020-01-14 21:55:34 +00:00
deriving (Eq, GHC.Generic, Ord, Show)
2020-01-16 22:27:38 +00:00
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
2020-01-14 21:55:34 +00:00
type ArchitectureSpec = Map Architecture PlatformSpec
2020-01-16 22:27:38 +00:00
type ToolVersionSpec = Map Version ArchitectureSpec
type AvailableDownloads = Map Tool ToolVersionSpec
2020-01-14 21:55:34 +00:00
2020-01-16 22:27:38 +00:00
data URLSource = GHCupURL
| OwnSource URL
| OwnSpec AvailableDownloads