Skip to content

Commit

Permalink
Fix deprecation error
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffhappily committed Feb 7, 2020
1 parent 8455531 commit ba62f87
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
29 changes: 27 additions & 2 deletions src/Path/Extended.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,40 @@

module Path.Extended
( fileExtension
, addExtension
, replaceExtension
) where

import Control.Monad.Catch
import qualified Path as Path
import qualified Path
import Path (Path, File)

fileExtension :: MonadThrow m => Path.Path b Path.File -> m String
fileExtension :: MonadThrow m => Path b File -> m String
fileExtension =
#if MIN_VERSION_path(0,7,0)
Path.fileExtension
#else
pure . Path.fileExtension
#endif

addExtension :: MonadThrow m
=> String
-> Path b File
-> m (Path b File)
addExtension =
#if MIN_VERSION_path(0,7,0)
Path.addExtension
#else
Path.addFileExtension
#endif

replaceExtension :: MonadThrow m
=> String
-> Path b File
-> m (Path b File)
replaceExtension =
#if MIN_VERSION_path(0,7,0)
Path.replaceExtension
#else
flip (Path.-<.>)
#endif
2 changes: 1 addition & 1 deletion src/Stack/Coverage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import RIO.Process
import Trace.Hpc.Tix
import Web.Browser (openBrowser)

data CoverageException = NonTestSuiteTarget PackageName deriving Typeable
newtype CoverageException = NonTestSuiteTarget PackageName deriving Typeable

instance Exception CoverageException
instance Show CoverageException where
Expand Down
7 changes: 6 additions & 1 deletion src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ import qualified Data.Text.Encoding as T
import Data.Time (UTCTime)
import Data.Version (showVersion)
import Distribution.Version (mkVersion)
#if MIN_VERSION_path(0,7,0)
import Path hiding (replaceExtension)
#else
import Path
#endif
import Path.Extended (replaceExtension)
import Path.Extra (toFilePathNoTrailingSep)
import Path.IO hiding (canonicalizePath)
import qualified Paths_stack as Meta
Expand Down Expand Up @@ -150,7 +155,7 @@ getCmdArgs docker imageInfo isRemoteDocker = do
exePath <- ensureDockerStackExe dockerContainerPlatform
cmdArgs args exePath
cmdArgs args exePath = do
exeBase <- exePath -<.> ""
exeBase <- replaceExtension "" exePath
let mountPath = hostBinDir FP.</> toFilePath (filename exeBase)
return (mountPath, args, [], [Mount (toFilePath exePath) mountPath])

Expand Down
5 changes: 3 additions & 2 deletions src/Stack/Lock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import qualified Data.List.NonEmpty as NE
import qualified Data.Map as Map
import qualified Data.Yaml as Yaml
import Pantry
import Path (addFileExtension, parent)
import Path (parent)
import Path.Extended (addExtension)
import Path.IO (doesFileExist)
import Stack.Prelude
import Stack.SourceMap
Expand Down Expand Up @@ -94,7 +95,7 @@ lockCachedWanted ::
-> RIO env ( SMWanted, [CompletedPLI]))
-> RIO env SMWanted
lockCachedWanted stackFile resolver fillWanted = do
lockFile <- liftIO $ addFileExtension "lock" stackFile
lockFile <- liftIO $ addExtension ".lock" stackFile
let getLockExists = doesFileExist lockFile
lfb <- view lockFileBehaviorL
readLockFile <-
Expand Down

0 comments on commit ba62f87

Please sign in to comment.