Skip to content

Commit 64532b8

Browse files
committed
Remove WithCallStack IO type alias
1 parent 6c64494 commit 64532b8

30 files changed

+87
-96
lines changed

Cabal/Distribution/Compat/CopyFile.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ import System.IO
6969
import qualified System.Win32.File as Win32 ( copyFile )
7070
#endif /* mingw32_HOST_OS */
7171

72-
copyOrdinaryFile, copyExecutableFile :: FilePath -> FilePath -> NoCallStackIO ()
72+
copyOrdinaryFile, copyExecutableFile :: FilePath -> FilePath -> IO ()
7373
copyOrdinaryFile src dest = copyFile src dest >> setFileOrdinary dest
7474
copyExecutableFile src dest = copyFile src dest >> setFileExecutable dest
7575

76-
setFileOrdinary, setFileExecutable, setDirOrdinary :: FilePath -> NoCallStackIO ()
76+
setFileOrdinary, setFileExecutable, setDirOrdinary :: FilePath -> IO ()
7777
#ifndef mingw32_HOST_OS
7878
setFileOrdinary path = setFileMode path 0o644 -- file perms -rw-r--r--
7979
setFileExecutable path = setFileMode path 0o755 -- file perms -rwxr-xr-x
8080

81-
setFileMode :: FilePath -> FileMode -> NoCallStackIO ()
81+
setFileMode :: FilePath -> FileMode -> IO ()
8282
setFileMode name m =
8383
withFilePath name $ \s -> do
8484
throwErrnoPathIfMinus1_ "setFileMode" name (c_chmod s m)
@@ -91,7 +91,7 @@ setDirOrdinary = setFileExecutable
9191

9292
-- | Copies a file to a new destination.
9393
-- Often you should use `copyFileChanged` instead.
94-
copyFile :: FilePath -> FilePath -> NoCallStackIO ()
94+
copyFile :: FilePath -> FilePath -> IO ()
9595
copyFile fromFPath toFPath =
9696
copy
9797
`catchIO` (\ioe -> throwIO (ioeSetLocation ioe "copyFile"))
@@ -229,15 +229,15 @@ emptyToCurDir path = path
229229
-- | Like `copyFile`, but does not touch the target if source and destination
230230
-- are already byte-identical. This is recommended as it is useful for
231231
-- time-stamp based recompilation avoidance.
232-
copyFileChanged :: FilePath -> FilePath -> NoCallStackIO ()
232+
copyFileChanged :: FilePath -> FilePath -> IO ()
233233
copyFileChanged src dest = do
234234
equal <- filesEqual src dest
235235
unless equal $ copyFile src dest
236236

237237
-- | Checks if two files are byte-identical.
238238
-- Returns False if either of the files do not exist or if files
239239
-- are of different size.
240-
filesEqual :: FilePath -> FilePath -> NoCallStackIO Bool
240+
filesEqual :: FilePath -> FilePath -> IO Bool
241241
filesEqual f1 f2 = do
242242
ex1 <- doesFileExist f1
243243
ex2 <- doesFileExist f2

Cabal/Distribution/Compat/CreatePipe.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ createPipe = do
4444
hSetEncoding writeh localeEncoding
4545
return (readh, writeh)) `onException` (close readfd >> close writefd)
4646
where
47-
fdToHandle :: CInt -> IOMode -> NoCallStackIO Handle
47+
fdToHandle :: CInt -> IOMode -> IO Handle
4848
fdToHandle fd mode = do
4949
(fd', deviceType) <- mkFD fd mode (Just (Stream, 0, 0)) False False
5050
mkHandleFromFD fd' deviceType "" mode False Nothing

Cabal/Distribution/Compat/Environment.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import Foreign.C.Error (throwErrnoIfMinus1_)
3838
import System.Posix.Internals ( withFilePath )
3939
#endif /* mingw32_HOST_OS */
4040

41-
getEnvironment :: NoCallStackIO [(String, String)]
41+
getEnvironment :: IO [(String, String)]
4242
#ifdef mingw32_HOST_OS
4343
-- On Windows, the names of environment variables are case-insensitive, but are
4444
-- often given in mixed-case (e.g. "PATH" is "Path"), so we have to normalise

Cabal/Distribution/Compat/GetShortPathName.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ foreign import WINAPI unsafe "windows.h GetShortPathNameW"
4040
-- will always return the required buffer size for a
4141
-- specified lpszLongPath.
4242
--
43-
getShortPathName :: FilePath -> NoCallStackIO FilePath
43+
getShortPathName :: FilePath -> IO FilePath
4444
getShortPathName path =
4545
Win32.withTString path $ \c_path -> do
4646
c_len <- Win32.failIfZero "GetShortPathName #1 failed!" $
@@ -53,7 +53,7 @@ getShortPathName path =
5353

5454
#else
5555

56-
getShortPathName :: FilePath -> NoCallStackIO FilePath
56+
getShortPathName :: FilePath -> IO FilePath
5757
getShortPathName path = return path
5858

5959
#endif

Cabal/Distribution/Compat/Prelude.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ module Distribution.Compat.Prelude (
4444
IsString (..),
4545

4646
-- * Some types
47-
IO, NoCallStackIO,
4847
Map,
4948
Set,
5049
Identity (..),
@@ -106,7 +105,7 @@ module Distribution.Compat.Prelude (
106105
) where
107106
-- We also could hide few partial function
108107
import Prelude as BasePrelude hiding
109-
( IO, mapM, mapM_, sequence, null, length, foldr, any, all, head, tail, last, init
108+
( mapM, mapM_, sequence, null, length, foldr, any, all, head, tail, last, init
110109
-- partial functions
111110
, read
112111
, foldr1, foldl1
@@ -165,14 +164,8 @@ import Text.Read (readMaybe)
165164

166165
import qualified Text.PrettyPrint as Disp
167166

168-
import qualified Prelude as OrigPrelude
169-
import Distribution.Compat.Stack
170-
171167
import Distribution.Utils.Structured (Structured)
172168

173-
type IO a = WithCallStack (OrigPrelude.IO a)
174-
type NoCallStackIO a = OrigPrelude.IO a
175-
176169
-- | New name for 'Text.PrettyPrint.<>'
177170
(<<>>) :: Disp.Doc -> Disp.Doc -> Disp.Doc
178171
(<<>>) = (Disp.<>)

Cabal/Distribution/Compat/Time.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ instance Read ModTime where
7272
--
7373
-- This is a modified version of the code originally written for Shake by Neil
7474
-- Mitchell. See module Development.Shake.FileInfo.
75-
getModTime :: FilePath -> NoCallStackIO ModTime
75+
getModTime :: FilePath -> IO ModTime
7676

7777
#if defined mingw32_HOST_OS
7878

@@ -110,7 +110,7 @@ getModTime path = allocaBytes size_WIN32_FILE_ATTRIBUTE_DATA $ \info -> do
110110
foreign import CALLCONV "windows.h GetFileAttributesExW"
111111
c_getFileAttributesEx :: LPCTSTR -> Int32 -> LPVOID -> Prelude.IO BOOL
112112

113-
getFileAttributesEx :: String -> LPVOID -> NoCallStackIO BOOL
113+
getFileAttributesEx :: String -> LPVOID -> IO BOOL
114114
getFileAttributesEx path lpFileInformation =
115115
withTString path $ \c_path ->
116116
c_getFileAttributesEx c_path getFileExInfoStandard lpFileInformation
@@ -154,14 +154,14 @@ posixTimeToModTime p = ModTime $ (ceiling $ p * 1e7) -- 100 ns precision
154154
+ (secToUnixEpoch * windowsTick)
155155

156156
-- | Return age of given file in days.
157-
getFileAge :: FilePath -> NoCallStackIO Double
157+
getFileAge :: FilePath -> IO Double
158158
getFileAge file = do
159159
t0 <- getModificationTime file
160160
t1 <- getCurrentTime
161161
return $ realToFrac (t1 `diffUTCTime` t0) / realToFrac posixDayLength
162162

163163
-- | Return the current time as 'ModTime'.
164-
getCurTime :: NoCallStackIO ModTime
164+
getCurTime :: IO ModTime
165165
getCurTime = posixTimeToModTime `fmap` getPOSIXTime -- Uses 'gettimeofday'.
166166

167167
-- | Based on code written by Neil Mitchell for Shake. See

Cabal/Distribution/PackageDescription/Check.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ checkDevelopmentOnlyFlags pkg =
18861886
-- | Sanity check things that requires IO. It looks at the files in the
18871887
-- package and expects to find the package unpacked in at the given file path.
18881888
--
1889-
checkPackageFiles :: Verbosity -> PackageDescription -> FilePath -> NoCallStackIO [PackageCheck]
1889+
checkPackageFiles :: Verbosity -> PackageDescription -> FilePath -> IO [PackageCheck]
18901890
checkPackageFiles verbosity pkg root = do
18911891
contentChecks <- checkPackageContent checkFilesIO pkg
18921892
preDistributionChecks <- checkPackageFilesPreDistribution verbosity pkg root
@@ -2202,7 +2202,7 @@ checkTarPath path
22022202
-- check these on the server; these checks only make sense in the development
22032203
-- and package-creation environment. Hence we can use IO, rather than needing
22042204
-- to pass a 'CheckPackageContentOps' dictionary around.
2205-
checkPackageFilesPreDistribution :: Verbosity -> PackageDescription -> FilePath -> NoCallStackIO [PackageCheck]
2205+
checkPackageFilesPreDistribution :: Verbosity -> PackageDescription -> FilePath -> IO [PackageCheck]
22062206
-- Note: this really shouldn't return any 'Inexcusable' warnings,
22072207
-- because that will make us say that Hackage would reject the package.
22082208
-- But, because Hackage doesn't run these tests, that will be a lie!
@@ -2212,7 +2212,7 @@ checkPackageFilesPreDistribution = checkGlobFiles
22122212
checkGlobFiles :: Verbosity
22132213
-> PackageDescription
22142214
-> FilePath
2215-
-> NoCallStackIO [PackageCheck]
2215+
-> IO [PackageCheck]
22162216
checkGlobFiles verbosity pkg root =
22172217
fmap concat $ for allGlobs $ \(field, dir, glob) ->
22182218
-- Note: we just skip over parse errors here; they're reported elsewhere.

Cabal/Distribution/PackageDescription/PrettyPrint.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import Text.PrettyPrint (Doc, char, hsep, parens, text, (<+>))
5757
import qualified Data.ByteString.Lazy.Char8 as BS.Char8
5858

5959
-- | Writes a .cabal file from a generic package description
60-
writeGenericPackageDescription :: FilePath -> GenericPackageDescription -> NoCallStackIO ()
60+
writeGenericPackageDescription :: FilePath -> GenericPackageDescription -> IO ()
6161
writeGenericPackageDescription fpath pkg = writeUTF8File fpath (showGenericPackageDescription pkg)
6262

6363
-- | Writes a generic package description to a string
@@ -192,7 +192,7 @@ ppIfCondition :: Condition ConfVar -> [PrettyField ()] -> PrettyField ()
192192
ppIfCondition c = PrettySection () "if" [ppCondition c]
193193

194194
-- | @since 2.0.0.2
195-
writePackageDescription :: FilePath -> PackageDescription -> NoCallStackIO ()
195+
writePackageDescription :: FilePath -> PackageDescription -> IO ()
196196
writePackageDescription fpath pkg = writeUTF8File fpath (showPackageDescription pkg)
197197

198198
--TODO: make this use section syntax
@@ -225,7 +225,7 @@ pdToGpd pd = GenericPackageDescription
225225
mkCondTree' f x = (f x, CondNode x [] [])
226226

227227
-- | @since 2.0.0.2
228-
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> NoCallStackIO ()
228+
writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> IO ()
229229
writeHookedBuildInfo fpath = writeFileAtomic fpath . BS.Char8.pack
230230
. showHookedBuildInfo
231231

Cabal/Distribution/PackageDescription/Quirks.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ patches = Map.fromList
256256
mk a b c d = ((a, b), (c, d))
257257

258258
-- | Helper to create entries in patches
259-
_makePatchKey :: FilePath -> (BS.ByteString -> BS.ByteString) -> NoCallStackIO ()
259+
_makePatchKey :: FilePath -> (BS.ByteString -> BS.ByteString) -> IO ()
260260
_makePatchKey fp transform = do
261261
contents <- BS.readFile fp
262262
let output = transform contents

Cabal/Distribution/Simple.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ clean pkg_descr flags = do
606606
traverse_ (writePersistBuildConfig distPref) maybeConfig
607607

608608
where
609-
removeFileOrDirectory :: FilePath -> NoCallStackIO ()
609+
removeFileOrDirectory :: FilePath -> IO ()
610610
removeFileOrDirectory fname = do
611611
isDir <- doesDirectoryExist fname
612612
isFile <- doesFileExist fname

0 commit comments

Comments
 (0)