forked from commercialhaskell/stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🆕 Add config build-plan-url-prefixes
Related: commercialhaskell#1794
- Loading branch information
Showing
8 changed files
with
81 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Stack.Config.BuildPlanUrlPrefixes (buildPlanUrlPrefixesFromMonoid) where | ||
|
||
import Stack.Types | ||
import Data.Maybe | ||
|
||
buildPlanUrlPrefixesFromMonoid | ||
:: BuildPlanUrlPrefixesMonoid -> BuildPlanUrlPrefixes | ||
buildPlanUrlPrefixesFromMonoid monoid = | ||
BuildPlanUrlPrefixes | ||
(fromMaybe defaultLts $ buildPlanUrlPrefixesMonoidLts monoid) | ||
(fromMaybe defaultNightly $ buildPlanUrlPrefixesMonoidNightly monoid) | ||
where | ||
defaultLts = | ||
"https://raw.githubusercontent.com/fpco/lts-haskell/master/" | ||
defaultNightly = | ||
"https://raw.githubusercontent.com/fpco/stackage-nightly/master/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{-# LANGUAGE OverloadedStrings, FlexibleInstances #-} | ||
|
||
module Stack.Types.BuildPlanUrlPrefixes where | ||
|
||
import Control.Applicative | ||
import Data.Aeson.Extended | ||
import Data.Text (Text) | ||
import Data.Monoid | ||
|
||
data BuildPlanUrlPrefixes = BuildPlanUrlPrefixes | ||
{ buildPlanUrlPrefixesLts :: !Text | ||
, buildPlanUrlPrefixesNightly :: !Text | ||
} | ||
deriving Show | ||
|
||
instance FromJSON (WithJSONWarnings BuildPlanUrlPrefixes) where | ||
parseJSON = withObjectWarnings "BuildPlanUrlPrefixes" $ \o -> do | ||
BuildPlanUrlPrefixes <$> o ..: "lts" <*> o ..: "nightly" | ||
|
||
data BuildPlanUrlPrefixesMonoid = BuildPlanUrlPrefixesMonoid | ||
{ buildPlanUrlPrefixesMonoidLts :: !(Maybe Text) | ||
, buildPlanUrlPrefixesMonoidNightly :: !(Maybe Text) | ||
} | ||
deriving Show | ||
|
||
instance FromJSON (WithJSONWarnings BuildPlanUrlPrefixesMonoid) where | ||
parseJSON = withObjectWarnings "BuildPlanUrlPrefixesMonoid" $ \o -> do | ||
BuildPlanUrlPrefixesMonoid <$> o ..: "lts" <*> o ..: "nightly" | ||
|
||
instance Monoid BuildPlanUrlPrefixesMonoid where | ||
mempty = BuildPlanUrlPrefixesMonoid Nothing Nothing | ||
mappend l r = BuildPlanUrlPrefixesMonoid | ||
{ buildPlanUrlPrefixesMonoidLts = buildPlanUrlPrefixesMonoidLts l <|> buildPlanUrlPrefixesMonoidLts r | ||
, buildPlanUrlPrefixesMonoidNightly = buildPlanUrlPrefixesMonoidNightly l <|> buildPlanUrlPrefixesMonoidNightly r | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters