From d30d2ac8a5c52cb022d380b4af4212fb75d80d8c Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Tue, 28 Jul 2020 20:55:00 +0200 Subject: [PATCH] Add cabal-install-3.4.0.0-rc1 --- app/ghcup-gen/Validate.hs | 1 + app/ghcup/BrickMain.hs | 2 ++ app/ghcup/Main.hs | 1 + lib/GHCup/Types.hs | 1 + lib/GHCup/Types/JSON.hs | 2 ++ 5 files changed, 7 insertions(+) diff --git a/app/ghcup-gen/Validate.hs b/app/ghcup-gen/Validate.hs index bd1ee0e..4dc214f 100644 --- a/app/ghcup-gen/Validate.hs +++ b/app/ghcup-gen/Validate.hs @@ -111,6 +111,7 @@ validate dls = do where isUniqueTag Latest = True isUniqueTag Recommended = True + isUniqueTag Prerelease = False isUniqueTag (Base _) = False isUniqueTag (UnknownTag _) = False diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index 67eea69..a40cb1b 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -112,6 +112,7 @@ ui AppState {..} = printTag Recommended = withAttr "recommended" $ str "recommended" printTag Latest = withAttr "latest" $ str "latest" + printTag Prerelease = withAttr "prerelease" $ str "prerelease" printTag (Base pvp'') = str ("base-" ++ T.unpack (prettyPVP pvp'')) printTag (UnknownTag t ) = str t @@ -137,6 +138,7 @@ defaultAttributes = attrMap , ("installed" , Vty.defAttr `Vty.withForeColor` Vty.green) , ("recommended" , Vty.defAttr `Vty.withForeColor` Vty.green) , ("latest" , Vty.defAttr `Vty.withForeColor` Vty.yellow) + , ("prerelease" , Vty.defAttr `Vty.withForeColor` Vty.red) , ("help" , Vty.defAttr `Vty.withStyle` Vty.italic) ] diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 7cb639d..cf42698 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1422,6 +1422,7 @@ printListResult raw lr = do where printTag Recommended = color' Green "recommended" printTag Latest = color' Yellow "latest" + printTag Prerelease = color' Red "prerelease" printTag (Base pvp'') = "base-" ++ T.unpack (prettyPVP pvp'') printTag (UnknownTag t ) = t color' = case raw of diff --git a/lib/GHCup/Types.hs b/lib/GHCup/Types.hs index df6a8e5..070b2ec 100644 --- a/lib/GHCup/Types.hs +++ b/lib/GHCup/Types.hs @@ -92,6 +92,7 @@ data VersionInfo = VersionInfo -- | A tag. These are currently attached to a version of a tool. data Tag = Latest | Recommended + | Prerelease | Base PVP | UnknownTag String -- ^ used for upwardscompat deriving (Ord, Eq, Show) -- FIXME: manual JSON instance diff --git a/lib/GHCup/Types/JSON.hs b/lib/GHCup/Types/JSON.hs index c87e33d..c055894 100644 --- a/lib/GHCup/Types/JSON.hs +++ b/lib/GHCup/Types/JSON.hs @@ -53,6 +53,7 @@ deriveJSON defaultOptions { fieldLabelModifier = removeLensFieldLabel } ''Requir instance ToJSON Tag where toJSON Latest = String "Latest" toJSON Recommended = String "Recommended" + toJSON Prerelease = String "Prerelease" toJSON (Base pvp'') = String ("base-" <> prettyPVP pvp'') toJSON (UnknownTag x ) = String (T.pack x) @@ -60,6 +61,7 @@ instance FromJSON Tag where parseJSON = withText "Tag" $ \t -> case T.unpack t of "Latest" -> pure Latest "Recommended" -> pure Recommended + "Prerelease" -> pure Prerelease ('b' : 'a' : 's' : 'e' : '-' : ver') -> case pvp (T.pack ver') of Right x -> pure $ Base x Left e -> fail . show $ e