Skip to content

Commit 29c3f67

Browse files
luispedrohs-viktor
andcommitted
Use the more polymorphic <> to concatenate strings
Just in case we ever move a String type that is not a [Char], but something more like UTF-8 text. The more polymorphic <> should work even if String is no longer a list. Also, add a signature to throwErrnoTwoPathsIfMinus1_ Co-authored-by: Viktor Dukhovni <[email protected]>
1 parent 82fcb2b commit 29c3f67

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

System/Posix/Files.hsc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,18 @@ import System.Posix.Files.Common
102102
import System.Posix.Error
103103
import System.Posix.Internals
104104

105+
#if !MIN_VERSION_base(4, 11, 0)
106+
import Data.Monoid ((<>))
107+
#endif
108+
105109
import Data.Time.Clock.POSIX (POSIXTime)
106110

107111
-- throwErrnoTwoPathsIfMinus1_
108112
--
109113
-- | For operations that require two paths (e.g., renaming a file)
114+
throwErrnoTwoPathsIfMinus1_ :: (Eq a, Num a) => String -> FilePath -> FilePath -> IO a -> IO ()
110115
throwErrnoTwoPathsIfMinus1_ loc path1 path2 =
111-
throwErrnoIfMinus1_ (loc ++ " '" ++ path1 ++ "' to '" ++ path2 ++ "'")
116+
throwErrnoIfMinus1_ (loc <> " '" <> path1 <> "' to '" <> path2 <> "'")
112117

113118
-- -----------------------------------------------------------------------------
114119
-- chmod()

0 commit comments

Comments
 (0)