@@ -49,7 +49,7 @@ import qualified Data.Yaml as Yaml
4949import Distribution.System
5050 ( Arch (OtherArch ), OS (.. ), Platform (.. ), buildPlatform )
5151import qualified Distribution.Text
52- import Distribution.Version ( simplifyVersionRange , mkVersion' )
52+ import Distribution.Version ( simplifyVersionRange )
5353import GHC.Conc ( getNumProcessors )
5454import Network.HTTP.StackClient
5555 ( httpJSON , parseUrlThrow , getResponseBody )
@@ -59,7 +59,6 @@ import Path
5959import Path.Extra ( toFilePathNoTrailingSep )
6060import Path.Find ( findInParents )
6161import Path.IO
62- import qualified Paths_stack as Meta
6362import RIO.List ( unzip )
6463import RIO.Process
6564import RIO.Time ( toGregorian )
@@ -82,6 +81,9 @@ import Stack.Types.Nix
8281import Stack.Types.Resolver
8382import Stack.Types.SourceMap
8483import Stack.Types.Version
84+ ( IntersectingVersionRange (.. ), VersionCheck (.. )
85+ , stackVersion , withinRange
86+ )
8587import System.Console.ANSI
8688 ( hSupportsANSIWithoutEmulation , setSGRCode )
8789import System.Environment
@@ -91,8 +93,8 @@ import System.PosixCompat.User ( getEffectiveUserID )
9193
9294-- | If deprecated path exists, use it and print a warning.
9395-- Otherwise, return the new path.
94- tryDeprecatedPath
95- :: HasLogFunc env
96+ tryDeprecatedPath ::
97+ HasLogFunc env
9698 => Maybe T. Text -- ^ Description of file for warning (if Nothing, no deprecation warning is displayed)
9799 -> (Path Abs a -> RIO env Bool ) -- ^ Test for existence
98100 -> Path Abs a -- ^ New path
@@ -121,8 +123,8 @@ tryDeprecatedPath mWarningDesc exists new old = do
121123-- | Get the location of the implicit global project directory.
122124-- If the directory already exists at the deprecated location, its location is returned.
123125-- Otherwise, the new location is returned.
124- getImplicitGlobalProjectDir
125- :: HasLogFunc env
126+ getImplicitGlobalProjectDir ::
127+ HasLogFunc env
126128 => Config -> RIO env (Path Abs Dir )
127129getImplicitGlobalProjectDir config =
128130 -- TEST no warning printed
@@ -145,8 +147,8 @@ getSnapshots = do
145147 pure $ getResponseBody result
146148
147149-- | Turn an 'AbstractResolver' into a 'Resolver'.
148- makeConcreteResolver
149- :: HasConfig env
150+ makeConcreteResolver ::
151+ HasConfig env
150152 => AbstractResolver
151153 -> RIO env RawSnapshotLocation
152154makeConcreteResolver (ARResolver r) = pure r
@@ -184,8 +186,8 @@ getLatestResolver = do
184186 pure $ RSLSynonym $ fromMaybe (Nightly (snapshotsNightly snapshots)) mlts
185187
186188-- Interprets ConfigMonoid options.
187- configFromConfigMonoid
188- :: HasRunner env
189+ configFromConfigMonoid ::
190+ HasRunner env
189191 => Path Abs Dir -- ^ Stack root, e.g. ~/.stack
190192 -> Path Abs File -- ^ user config file path, e.g. ~/.stack/config.yaml
191193 -> Maybe AbstractResolver
@@ -516,7 +518,7 @@ loadConfig inner = do
516518 (mconcat $ configArgs : addConfigMonoid extraConfigs)
517519
518520 withConfig $ \ config -> do
519- unless (mkVersion' Meta. version `withinRange` configRequireStackVersion config)
521+ unless (stackVersion `withinRange` configRequireStackVersion config)
520522 (throwM (BadStackVersionException (configRequireStackVersion config)))
521523 unless (configAllowDifferentUser config) $ do
522524 unless userOwnsStackRoot $
@@ -527,8 +529,8 @@ loadConfig inner = do
527529
528530-- | Load the build configuration, adds build-specific values to config loaded by @loadConfig@.
529531-- values.
530- withBuildConfig
531- :: RIO BuildConfig a
532+ withBuildConfig ::
533+ RIO BuildConfig a
532534 -> RIO Config a
533535withBuildConfig inner = do
534536 config <- ask
@@ -813,8 +815,8 @@ checkOwnership dir = do
813815
814816-- | @'getDirAndOwnership' dir@ returns @'Just' (dir, 'True')@ when @dir@
815817-- exists and the current user owns it in the sense of 'isOwnedByUser'.
816- getDirAndOwnership
817- :: (MonadIO m )
818+ getDirAndOwnership ::
819+ (MonadIO m )
818820 => Path Abs Dir
819821 -> m (Maybe (Path Abs Dir , Bool ))
820822getDirAndOwnership dir = liftIO $ forgivingAbsence $ do
@@ -864,8 +866,8 @@ getExtraConfigs userConfigPath = do
864866
865867-- | Load and parse YAML from the given config file. Throws
866868-- 'ParseConfigFileException' when there's a decoding error.
867- loadConfigYaml
868- :: HasLogFunc env
869+ loadConfigYaml ::
870+ HasLogFunc env
869871 => (Value -> Yaml. Parser (WithJSONWarnings a )) -> Path Abs File -> RIO env a
870872loadConfigYaml parser path = do
871873 eres <- loadYaml parser path
@@ -875,8 +877,8 @@ loadConfigYaml parser path = do
875877 Right res -> pure res
876878
877879-- | Load and parse YAML from the given file.
878- loadYaml
879- :: HasLogFunc env
880+ loadYaml ::
881+ HasLogFunc env
880882 => (Value -> Yaml. Parser (WithJSONWarnings a )) -> Path Abs File -> RIO env (Either Yaml. ParseException a )
881883loadYaml parser path = do
882884 eres <- liftIO $ Yaml. decodeFileEither (toFilePath path)
@@ -946,8 +948,8 @@ loadProjectConfig mstackYaml = do
946948-- | Get the location of the default Stack configuration file.
947949-- If a file already exists at the deprecated location, its location is returned.
948950-- Otherwise, the new location is returned.
949- getDefaultGlobalConfigPath
950- :: HasLogFunc env
951+ getDefaultGlobalConfigPath ::
952+ HasLogFunc env
951953 => RIO env (Maybe (Path Abs File ))
952954getDefaultGlobalConfigPath =
953955 case (defaultGlobalConfigPath, defaultGlobalConfigPathDeprecated) of
@@ -964,8 +966,8 @@ getDefaultGlobalConfigPath =
964966-- | Get the location of the default user configuration file.
965967-- If a file already exists at the deprecated location, its location is returned.
966968-- Otherwise, the new location is returned.
967- getDefaultUserConfigPath
968- :: HasLogFunc env
969+ getDefaultUserConfigPath ::
970+ HasLogFunc env
969971 => Path Abs Dir -> RIO env (Path Abs File )
970972getDefaultUserConfigPath stackRoot = do
971973 (path, exists) <- tryDeprecatedPath
0 commit comments