{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} module Stack.Types.GHCDownloadInfo ( GHCDownloadInfo (..) ) where import Data.Aeson.Types ( FromJSON (..) ) import Data.Aeson.WarningParser ( WithJSONWarnings (..), (..:?), (..!=), withObjectWarnings ) import Stack.Prelude import Stack.Types.DownloadInfo ( DownloadInfo, parseDownloadInfoFromObject ) data GHCDownloadInfo = GHCDownloadInfo { GHCDownloadInfo -> [Text] gdiConfigureOpts :: [Text] , GHCDownloadInfo -> Map Text Text gdiConfigureEnv :: Map Text Text , GHCDownloadInfo -> DownloadInfo gdiDownloadInfo :: DownloadInfo } deriving Int -> GHCDownloadInfo -> ShowS [GHCDownloadInfo] -> ShowS GHCDownloadInfo -> String (Int -> GHCDownloadInfo -> ShowS) -> (GHCDownloadInfo -> String) -> ([GHCDownloadInfo] -> ShowS) -> Show GHCDownloadInfo forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> GHCDownloadInfo -> ShowS showsPrec :: Int -> GHCDownloadInfo -> ShowS $cshow :: GHCDownloadInfo -> String show :: GHCDownloadInfo -> String $cshowList :: [GHCDownloadInfo] -> ShowS showList :: [GHCDownloadInfo] -> ShowS Show instance FromJSON (WithJSONWarnings GHCDownloadInfo) where parseJSON :: Value -> Parser (WithJSONWarnings GHCDownloadInfo) parseJSON = String -> (Object -> WarningParser GHCDownloadInfo) -> Value -> Parser (WithJSONWarnings GHCDownloadInfo) forall a. String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a) withObjectWarnings String "GHCDownloadInfo" ((Object -> WarningParser GHCDownloadInfo) -> Value -> Parser (WithJSONWarnings GHCDownloadInfo)) -> (Object -> WarningParser GHCDownloadInfo) -> Value -> Parser (WithJSONWarnings GHCDownloadInfo) forall a b. (a -> b) -> a -> b $ \Object o -> do [Text] configureOpts <- Object o Object -> Text -> WarningParser (Maybe [Text]) forall a. FromJSON a => Object -> Text -> WarningParser (Maybe a) ..:? Text "configure-opts" WarningParser (Maybe [Text]) -> [Text] -> WarningParser [Text] forall a. WarningParser (Maybe a) -> a -> WarningParser a ..!= [Text] forall a. Monoid a => a mempty Map Text Text configureEnv <- Object o Object -> Text -> WarningParser (Maybe (Map Text Text)) forall a. FromJSON a => Object -> Text -> WarningParser (Maybe a) ..:? Text "configure-env" WarningParser (Maybe (Map Text Text)) -> Map Text Text -> WarningParser (Map Text Text) forall a. WarningParser (Maybe a) -> a -> WarningParser a ..!= Map Text Text forall a. Monoid a => a mempty DownloadInfo downloadInfo <- Object -> WarningParser DownloadInfo parseDownloadInfoFromObject Object o GHCDownloadInfo -> WarningParser GHCDownloadInfo forall a. a -> WriterT WarningParserMonoid Parser a forall (f :: * -> *) a. Applicative f => a -> f a pure GHCDownloadInfo { gdiConfigureOpts :: [Text] gdiConfigureOpts = [Text] configureOpts , gdiConfigureEnv :: Map Text Text gdiConfigureEnv = Map Text Text configureEnv , gdiDownloadInfo :: DownloadInfo gdiDownloadInfo = DownloadInfo downloadInfo }