packages feed

pathtype 0.7.0.1 → 0.8

raw patch · 15 files changed

+1388/−996 lines, 15 filesdep ~transformers

Dependency ranges changed: transformers

Files

CHANGELOG view
@@ -1,5 +1,40 @@-0.7----+0.8:++* relPath, absPath, filePath, dirPath deprecated in favor of+  Path.rel, Path.abs, Path.absRel, Path.file, Path.dir+  Same for the according type synonyms.++* Deprecate extended path construction functions:+  mkAbsPath, mkAbsPathFromCwd, mkPathAbsOrRel, mkPathFileOrDir+  You better combine path constructors and further manipulations.++* Deprecate functions based on path strings.+  You should better use functions from the filepath package.++* absRel -> withAbsRel, fileDir -> withFileDir+  We do not need these functions very often+  and instead we need Path.absRel as constructor name+  that is consistent with Path.abs and Path.rel.++* Split main module into multiple one,+  in order to use a consistent name set for every aspect.++  E.g. we have:+  Path.Abs: an absolute path+  Path.Part.Abs: absolute (drive) part of a path+  Path.PartClass.Abs: class for an absolute part++  Path.AbsRel: an absolute or relative path+  Path.Part.AbsRel: initial part of an absolute or relative path+  Path.PartClass.AbsRel: class for absolute or relative parts++  Path.Abs -> Part.Abs+  Path.AbsOrRel -> Part.AbsRel+  Path.AbsOrRelClass -> PartClass.AbsRel+  Path.FileOrDirClass -> PartClass.FileDir++0.7:+ * Move absRel and fileDir out of their classes.   A problem would arise if someone writes     import System.Path (AbsRelClass(absRel))@@ -41,8 +76,8 @@  * clarify handling of file system links -0.6----+0.6:+ * joinPath: restrict to RelPath and atomic path components  * Add type class constraints and restrict types@@ -52,8 +87,8 @@  * Add support for MS Windows paths with leading drive labels -0.5.5------+0.5.5:+ * AbsRelClass, FileDirClass: turn into closed-world classes.   Strict accordance to PVP would require to bump version to 0.6,   but since the user cannot write instances of this class,@@ -64,29 +99,29 @@ * IO.withFile restricted to FilePath   This changes API but it should only break buggy code. -0.5.4.3--------+0.5.4.3:+ * Make test suite static part of the source code,   but maintain a program to update the test suite to changed tests. -0.5.4.1--------+0.5.4.1:+ * Merge git back to darcs, continue on hub.darcs.net -0.5.4------+0.5.4:+ * Migrated from darcs to git (on GitHub) -0.5.3------+0.5.3:+ * Upgrades + changes for GHC 7.6.1 - by Ben Millwood -0.5.0------+0.5.0:+ * Added System.Path.Windows and System.Path.Posix modules. These are modelled on the System.FilePath approach to supporting the two styles of path. -0.0.2------+0.0.2:+ * Split System.Path.Directory into its own module * Implemented covers for all the remaining System.Directory functions * Renamed 'hasExtension' to 'hasAnExtension', and added new 'hasExtension' fn which checks for a given extension@@ -101,6 +136,6 @@ * Changed behaviour of 'getDirectoryContents' to return relative paths * Fixed the type of 'setCurrentDirectory' -0.0.1------+0.0.1:+ Initial Release
+ README.md view
@@ -0,0 +1,243 @@+# Construction of type-safe paths++You can use the construction functions as follows:++    f :: Path.RelFile+    f = relDir "tmp" </> relFile "someFile" <.> "ext"++or ...++    f :: Path.RelFile+    f = dirPath "tmp" </> filePath "someFile" <.> "ext"++or ...++    f :: Path.RelFile+    f = path "tmp" </> path "someFile" <.> "ext"++or just ...++    f :: Path.RelFile+    f = relFile "tmp/someFile.ext"++The first and the last implementations force the most specific types+and thus should be prefered.++Overloaded string literals are no longer supported,+since this extension is intended for alternative text storage types.+It would also decrease the type safety+if you could omit the path type and let the compiler guess its type.+++# Modules++You will typically want to import as follows:++    import qualified System.Path.Directory as Dir+    import qualified System.Path.IO as PathIO+    import qualified System.Path as Path+    import System.Path ((</>))++`System.Path.Generic` provides all functions with the OS as type parameter.+`System.Path.Posix` and `System.Path.Windows`+offers only path constructors and destructors+fixed to the corresponding operating system.+`System.Path` exports either `System.Path.Posix` or `System.Path.Windows`+depending on the host system+and additionally the manipulation functions from `System.Path.Generic`.+This mix should be appropriate for the average use+and should free the user from writing type annotations.+++# How to choose proper type arguments++The `ar` and the `fd` type parameters have quite different meaning.+The types `Abs` and `Rel` refer to a property of the path,+whereas the type `File` and `Dir` refers to a property of a disk object.+You can decide whether a path is absolute or relative+by just watching (the beginning of) the path string.+In contrast to that, you have to access the disk+in order to check the existence and type of an disk object.+Even more, the disk object might change at any time,+e.g. the user might delete a file and create a directory of the same name,+or the disk object might not exist,+and the purpose of the path is to create an according file or directory.+That's why even if you have a path of type `FilePath ar`,+every function accessing the file must check+that the refered object exists and is a file.+Conversely, there is not much sense in checking the disk object type+and then chosing the path accordingly.+Instead, you must choose the path type according+to what type of disk object your application needs.+The reality check must be performed+and is performed by the standard functions+for every access to the object.+If an disk object is not of the type required by the path type+then this is a runtime exception that must be handled at runtime+but it is not a programming error.++Sometimes you have to change the type of a path+as an intermediate step to construct a path for an object of different type.+E.g. you may convert the path "pkg" from `DirPath` to `FilePath`+because in the next step you like to extend it to "pkg.tar.gz".+This is valid use of the `Path` type.+E.g. the function `dropExtensions`+reduces the `FilePath` "pkg.tar.gz" to the new `FilePath` "pkg"+although no-one expects that there is or will be a file with name "pkg".+Thus, if a function has a `FilePath` parameter+then there is no warranty that it accesses the according file+and does not touch related disk objects.+It may well be that the function derives other file and directory names+from the path and accesses them.+That is, a `FilePath` or `DirPath` parameter+is mainly for documentation purposes+but it cannot prevent you seriously from any damage.+++# How to cope with user input++You may get a path from the user, e.g. as command-line argument.+It might be either absolute or relative+and it might refer to an actual file or directory or+to something yet non-existing.+In most cases it will not be important+whether the path is absolute or relative,+thus you should choose the `AbsRel` type parameter.+If somewhere in the program an `Abs` path is needed+then you can assert that the path is actually absolutized somewhere+e.g. by `dynamicMakeAbsolute`.+If you prevent usage of `genericMakeAbsolute`+then you avoid to absolutize a path that is already absolutized.++The choice of the `fd` type parameter follows a different reasoning:+Often you have a clear idea of+whether the user must pass a file or directory path.+The rule is: Just give the path the type you expect+but do not perform any checking+(unless you want to warn the user earlier about imminent danger).+The disk object type must checked for every access to the object, anyway,+so there is no point in checking it immediately.+With your choice of the `fd` parameter+you just document its intended use.++It might be that the path is only a base name+used to construct other directory and file names.+E.g. for an Audacity project named `music`+you have to create the directory `music_data` and the file `music.aup`.+In this case we recommend to give `music` the type `FilePath`.+This type warrants that there is at least one final path component+in contrast to a directory path that might be empty.+You can easily convert a file path to a directory path+using `Path.dirFromFile`.+The reverse conversion is partial.+++# AbsRel vs. `ar` type parameter++In your application you will often know+whether your path denotes a file or directory,+thus you will use the `Path.File` or `Path.Dir` type synonym.+In contrast to that, you will often not know+whether the path is relative or absolute+and often it does not even matter.+You can express this either by using the monomorphic type `Path.AbsRelFile`+or by using the parameterized type `Path.File ar`+with constraint `PathClass.AbsRel ar`.+We recommend to use the first variant for command-line option parsing+and the second one for the application functions.+When you parse options it is the time where you know that you do not know+whether the path is absolute or relative.+That is, you could neither parse it as `Path.Abs` nor as `Path.Rel`.+Thus a type variable makes no sense.+You should always parse to type `Path.AbsRel`.+Conversely, your application would work equally well with+`Path.Abs`, `Path.Rel` and `Path.AbsRel`.+Thus, using an `ar` type variable is the way to go.+You must make sure to use different `ar`-like variables for independent paths.+By equality of `ar`-like type variables+you can also document dependencies of paths for the programmers.+++# Command-line argument parsing with `optparse-applicative`++For parsing of path options with the `optparse-applicative` package+you might use the following helper functions:++    module Option where++    import qualified System.Path.PartClass as PathC+    import qualified System.Path as Path+    import qualified Options.Applicative as OP++    path :: (PathC.FileDir fd) => OP.ReadM (Path.AbsRel fd)+    path = OP.eitherReader Path.parse++    pathArgument ::+       PathC.FileDir fd =>+       OP.Mod OP.ArgumentFields (Path.AbsRel fd) -> OP.Parser (Path.AbsRel fd)+    pathArgument = OP.argument path++    pathOption ::+       PathC.FileDir fd =>+       OP.Mod OP.OptionFields (Path.AbsRel fd) -> OP.Parser (Path.AbsRel fd)+    pathOption = OP.option path++It performs minimal checking of path strings as part of option parsing.+E.g. it will report a user error if the user passes "abc/" as a file path.+++# File system links++This package does not explicitly handle file system links.+We treat a file path containing links like any other file path.+The same holds for directory paths.+A link is handled like any other path component.+++# Drive-relative paths on MS Windows++We use the `Rel` type for paths that can be relative to any directory.+We use the `Abs` type for all other paths,+i.e. for paths with explicit locations or+with restrictions on the set of locations.+Windows has a notion of drives and+maintains a current directory for every drive.+E.g. the path `"c:text.txt"` refers to the current directory of drive `C`.+Since it cannot be freely combined with other directories+we treat this path like an absolute path.+This is consistent with the behaviour of the `filepath` package.+E.g. `filepath` evaluates all of the expressions+`"\\abs" </> "c:driverel"`, `"c:\\abs" </> "c:driverel"`,+`"d:\\abs" </> "c:driverel"` to `"c:driverel"`.+In our package you would have to use `genericMakeAbsolute`+but we recommend to avoid its use.+++# Path format strings++You might allow a user to pass a format string such as+`"page%06d.png"` to your program.+How to integrate this into the type-safe path handling?+We recommend not to use the `Path` for the format string+but instead to define a custom type:++    newtype Format ar fd = Format String++    printf ::+       (PathC.AbsRel ar) =>+       Format ar fd -> Int -> Either String (Path ar fd)+    printf (Format fmt) n = Path.parse (Pf.printf fmt n)++This makes sure that you will access a path on disk+only after formatting the path string.+++# Known problems++## Mac++Currently we select the Posix module on Mac systems.+On the one hand this choice is right+since Mac uses slashes for path component separation.+On the other hand it is wrong+since Mac ignores case when comparing filepaths.
pathtype.cabal view
@@ -1,197 +1,46 @@ Name:                pathtype-Version:             0.7.0.1+Version:             0.8 Synopsis:            Type-safe replacement for System.FilePath etc Description:   This package provides type-safe access to filepath manipulations.   .   "System.Path" is designed to be used instead of "System.FilePath".   (It is intended to provide versions of functions from that-  module which have equivalent functionality but are more-  typesafe). "System.Path.Directory" is a companion module+  module which have equivalent functionality but are more typesafe).+  "System.Path.Directory" is a companion module   providing a type-safe alternative to "System.Directory".   .-  The heart of this module is the @'Path' ar fd@ abstract type which-  represents file and directory paths. The idea is that there are-  two type parameters - the first should be 'Abs' or 'Rel',-  and the second 'File' or 'Dir'. A number of type synonyms are-  provided for common types:+  The heart of this package is the @'Path' ar fd@ abstract type+  which represents file and directory paths.+  The idea is that there are two type parameters -+  the first should be 'Abs' or 'Rel', and the second 'File' or 'Dir'.+  A number of type synonyms are provided for common types:   .-  > type AbsFile     = Path Abs File-  > type RelFile     = Path Rel File-  > type AbsDir      = Path Abs Dir-  > type RelDir      = Path Rel Dir+  > type Path.AbsFile = Path Abs File+  > type Path.RelFile = Path Rel File+  > type Path.AbsDir  = Path Abs Dir+  > type Path.RelDir  = Path Rel Dir   >-  > type AbsPath  fd = Path Abs fd-  > type RelPath  fd = Path Rel fd-  > type FilePath ar = Path ar File-  > type DirPath  ar = Path ar Dir+  > type Path.Abs  fd = Path Abs fd+  > type Path.Rel  fd = Path Rel fd+  > type Path.File ar = Path ar File+  > type Path.Dir  ar = Path ar Dir   .   The type of the 'combine' (aka '</>') function gives the idea:   .-  > (</>) :: DirPath ar -> RelPath fd -> Path ar fd-  .-  Together this enables us to give more meaningful types to-  a lot of the functions, and (hopefully) catch a bunch more-  errors at compile time.-  .-  You can use the construction functions as follows:-  .-  > f :: Path.RelFile-  > f = relDir "tmp" </> relFile "someFile" <.> "ext"-  .-  or...-  .-  > f :: Path.RelFile-  > f = dirPath "tmp" </> filePath "someFile" <.> "ext"-  .-  or...-  .-  > f :: Path.RelFile-  > f = path "tmp" </> path "someFile" <.> "ext"-  .-  or just...-  .-  > f :: Path.RelFile-  > f = relFile "tmp/someFile.ext"-  .-  The first and the last implementations force the most specific types-  and thus should be prefered.-  .-  Overloaded string literals are no longer supported,-  since this extension is intended for alternative text storage types.-  It would also decrease the type safety-  if you could omit the path type and let the compiler guess its type.-  .-  You will typically want to import as follows:-  .-  > import qualified System.Path.Directory as Dir-  > import qualified System.Path.IO as PathIO-  > import qualified System.Path as Path-  > import System.Path ((</>))-  .-  "System.Path.Generic" provides all functions with the OS as type parameter.-  "System.Path.Posix" and "System.Path.Windows"-  offers only path constructors and destructors-  fixed to the corresponding operating system.-  "System.Path" exports either "System.Path.Posix" or "System.Path.Windows"-  depending on the host system-  and additionally the manipulation functions from "System.Path.Generic".-  This mix should be appropriate for the average use-  and should free the user from writing type annotations.-  .-  The basic API (and properties satisfied) are heavily influenced-  by Neil Mitchell's "System.FilePath" module.-  .-  .-  Some notes on how to choose proper type parameters:-  .-  The @ar@ and the @fd@ type parameters have quite different meaning.-  The types @Abs@ and @Rel@ refer to a property of the path,-  whereas the type @File@ and @Dir@ refers to a property of a disk object.-  You can decide whether a path is absolute or relative-  by just watching (the beginning of) the path string.-  In contrast to that, you have to access the disk-  in order to check the existence and type of an disk object.-  Even more, the disk object might change at any time,-  e.g. the user might delete a file and create a directory of the same name,-  or the disk object might not exist,-  and the purpose of the path is to create an according file or directory.-  That's why even if you have a path of type @FilePath ar@,-  every function accessing the file must check-  that the refered object exists and is a file.-  Conversely, there is not much sense in checking the disk object type-  and then chosing the path accordingly.-  Instead, you must choose the path type according-  to what type of disk object your application needs.-  The reality check must be performed-  and is performed by the standard functions-  for every access to the object.-  If an disk object is not of the type required by the path type-  then this is a runtime exception that must be handled at runtime-  but it is not a programming error.-  .-  Sometimes you have to change the type of a path-  as an intermediate step to construct a path for an object of different type.-  E.g. you may convert the path \"pkg\" from @DirPath@ to @FilePath@-  because in the next step you like to extend it to \"pkg.tar.gz\".-  This is valid use of the @Path@ type.-  E.g. the function @dropExtensions@-  reduces the @FilePath@ \"pkg.tar.gz\" to the new @FilePath@ \"pkg\"-  although no-one expects that there is or will be a file with name \"pkg\".-  Thus, if a function has a @FilePath@ parameter-  then there is no warranty that it accesses the according file-  and does not touch related disk objects.-  It may well be that the function derives other file and directory names-  from the path and accesses them.-  That is, a @FilePath@ or @DirPath@ parameter-  is mainly for documentation purposes-  but it cannot prevent you seriously from any damage.-  .-  How to cope with user input?-  You may get a path from the user, e.g. as command-line argument.-  It might be either absolute or relative-  and it might refer to an actual file or directory or-  to something yet non-existing.-  In most cases it will not be important-  whether the path is absolute or relative,-  thus you should choose the @AbsOrRel@ type parameter.-  If somewhere in the program an @Abs@ path is needed-  then you can assert that the path is actually absolutized somewhere-  e.g. by @dynamicMakeAbsolute@.-  If you prevent usage of @genericMakeAbsolute@-  then you avoid to absolutize a path that is already absolutized.-  .-  The choice of the @fd@ type parameter follows a different reasoning:-  Often you have a clear idea of-  whether the user must pass a file or directory path.-  The rule is: Just give the path the type you expect-  but do not perform any checking-  (unless you want to warn the user earlier about imminent danger).-  The disk object type must checked for every access to the object, anyway,-  so there is no point in checking it immediately.-  With your choice of the @fd@ parameter-  you just document its intended use.-  .-  It might be that the path is only a base name-  used to construct other directory and file names.-  E.g. for an Audacity project named @music@-  you have to create the directory @music_data@ and the file @music.aup@.-  In this case we recommend to give @music@ the type @FilePath@.-  This type warrants that there is at least one final path component-  in contrast to a directory path that might be empty.-  You can easily convert a file path to a directory path-  using @Path.dirFromFile@.-  The reverse conversion is partial.-  .-  .-  Some notes on file system links:-  .-  This package does not explicitly handle file system links.-  We treat a file path containing links like any other file path.-  The same holds for directory paths.-  A link is handled like any other path component.-  .+  > (</>) :: Path.Dir ar -> Path.Rel fd -> Path ar fd   .-  Some notes on drive-relative paths on Windows:+  Together this enables us to give more meaningful types+  to a lot of the functions,+  and (hopefully) catch a bunch more errors at compile time.   .-  We use the @Rel@ type for paths that can be relative to any directory.-  We use the @Abs@ type for all other paths,-  i.e. for paths with explicit locations or-  with restrictions on the set of locations.-  Windows has a notion of drives and-  maintains a current directory for every drive.-  E.g. the path @\"c:text.txt\"@ refers to the current directory of drive @C@.-  Since it cannot be freely combined with other directories-  we treat this path like an absolute path.-  This is consistent with the behaviour of the @filepath@ package.-  E.g. @filepath@ evaluates all of the expressions-  @\"\\\\abs\" \<\/\> \"c:driverel\"@, @\"c:\\\\abs\" \<\/\> \"c:driverel\"@,-  @\"d:\\\\abs\" \<\/\> \"c:driverel\"@ to @\"c:driverel\"@.-  In our package you would have to use @genericMakeAbsolute@-  but we recommend to avoid its use.+  For more details see the README.md file.   .   Related packages:   .+  * @filepath@: The API of Neil Mitchell's "System.FilePath" module+    (and properties satisfied) heavily influenced our package.+  .   * @path@: Provides a wrapper type around 'FilePath'     and maps to functions from @filepath@ package.     This warrants consistency with @filepath@ functions.@@ -210,6 +59,7 @@ Cabal-Version:       >=1.8 Extra-Source-Files:   CHANGELOG+  README.md   test/TestTemplate.hs   posix/System/Path/Host.hs   windows/System/Path/Host.hs@@ -221,7 +71,7 @@   Location: http://hub.darcs.net/thielema/pathtype/  Source-Repository this-  Tag:      0.7.0.1+  Tag:      0.8   Type:     darcs   Location: http://hub.darcs.net/thielema/pathtype/ @@ -231,7 +81,7 @@  Flag buildTools   Description: Build tool for updating test module-  Default:     True+  Default:     False  Library   Build-Depends:@@ -239,7 +89,7 @@     QuickCheck >= 2.1.0.1 && < 3,     deepseq >= 1.3 && <1.5,     time >= 1.0 && < 2,-    transformers >=0.3 && <0.5,+    transformers >=0.3 && <0.6,     tagged >=0.7 && <0.9,     base >= 4 && < 5 @@ -262,9 +112,13 @@     System.Path.IO     System.Path.Posix     System.Path.Windows+    System.Path.Part+    System.Path.PartClass   Other-Modules:     System.Path.Host     System.Path.Internal+    System.Path.Internal.Part+    System.Path.Internal.PartClass     System.Path.RegularExpression     System.Path.ModificationTime 
src/System/Path.hs view
@@ -7,15 +7,18 @@ import System.Path.Generic hiding (    System, Path,    AbsFile, RelFile, AbsDir, RelDir,+   Abs, Rel, File, Dir,+   AbsRelFile, AbsRelDir, AbsFileDir, RelFileDir,+   AbsRel, FileDir, AbsRelFileDir,    AbsPath, RelPath, FilePath, DirPath,-   AbsOrRelFile, AbsOrRelDir, AbsFileOrDir, RelFileOrDir,-   AbsOrRelPath, FileOrDirPath, AbsOrRelFileOrDir,+   AbsRelPath, FileDirPath,    asPath,    asRelFile, asRelDir, asAbsFile, asAbsDir,    asRelPath, asAbsPath, asFilePath, asDirPath,    isAbsoluteString, isRelativeString, equalFilePath,-   path, maybePath,+   path, maybe, maybePath, parse, parsePath,    relFile, relDir, absFile, absDir,+   abs, rel, absRel, file, dir, fileDir,    relPath, absPath, filePath, dirPath,    rootDir, currentDir, emptyFile,    toString,
src/System/Path/Directory.hs view
@@ -63,9 +63,10 @@  where +import qualified System.Path.Internal.PartClass as Class import qualified System.Path as Path import System.Path (-    Path, AbsOrRelClass, FileOrDirClass, path,+    Path, path,     AbsPath, AbsDir, AbsFile, RelPath, RelDir, RelFile,     DirPath, FilePath, absDir, (</>),     )@@ -87,36 +88,36 @@ ------------------------------------------------------------------------ -- Actions on directories -createDirectory :: AbsOrRelClass ar => DirPath ar -> IO ()+createDirectory :: Class.AbsRel ar => DirPath ar -> IO () createDirectory = SD.createDirectory . Path.toString -createDirectoryIfMissing :: AbsOrRelClass ar => Bool -> DirPath ar -> IO ()+createDirectoryIfMissing :: Class.AbsRel ar => Bool -> DirPath ar -> IO () createDirectoryIfMissing flag = SD.createDirectoryIfMissing flag . Path.toString -removeDirectory :: AbsOrRelClass ar => DirPath ar -> IO ()+removeDirectory :: Class.AbsRel ar => DirPath ar -> IO () removeDirectory = SD.removeDirectory . Path.toString -removeDirectoryRecursive :: AbsOrRelClass ar => DirPath ar -> IO ()+removeDirectoryRecursive :: Class.AbsRel ar => DirPath ar -> IO () removeDirectoryRecursive = SD.removeDirectoryRecursive . Path.toString  renameDirectory ::-  (AbsOrRelClass ar1, AbsOrRelClass ar2) => DirPath ar1 -> DirPath ar2 -> IO ()+  (Class.AbsRel ar1, Class.AbsRel ar2) => DirPath ar1 -> DirPath ar2 -> IO () renameDirectory p1 p2 =   SD.renameDirectory (Path.toString p1) (Path.toString p2)  -- | Retrieve the contents of a directory without any directory prefixes. -- In contrast to 'System.Directory.getDirectoryContents', -- exclude special directories \".\" and \"..\".-getDirectoryContents :: AbsOrRelClass ar => DirPath ar -> IO [Path.RelFileOrDir]+getDirectoryContents :: Class.AbsRel ar => DirPath ar -> IO [Path.RelFileDir] getDirectoryContents dir =     map Path.path <$> plainDirectoryContents dir  -- | Retrieve the contents of a directory path (which may be relative) as absolute paths absDirectoryContents ::-  AbsOrRelClass ar => DirPath ar -> IO ([AbsDir], [AbsFile])+  Class.AbsRel ar => DirPath ar -> IO ([AbsDir], [AbsFile]) absDirectoryContents p = do   cd <- absDir <$> SD.getCurrentDirectory-  let dir = Path.absRel id (cd </>) p+  let dir = Path.withAbsRel id (cd </>) p   mapPair (map (dir </>), map (dir </>)) <$> relDirectoryContents dir  -- | Returns paths relative /to/ the supplied (abs or relative) directory path.@@ -126,31 +127,31 @@ -- >                                                      ["file1A","file1B"]) -- relDirectoryContents ::-  AbsOrRelClass ar => DirPath ar -> IO ([RelDir], [RelFile])+  Class.AbsRel ar => DirPath ar -> IO ([RelDir], [RelFile]) relDirectoryContents dir = do   filenames <- plainDirectoryContents dir   mapPair (map (Path.relDir . fst), map (Path.relFile . fst)) .     partition snd . zip filenames       <$> mapM (doesDirectoryExist . (dir </>) . Path.relPath) filenames -plainDirectoryContents :: AbsOrRelClass ar => DirPath ar -> IO [String]+plainDirectoryContents :: Class.AbsRel ar => DirPath ar -> IO [String] plainDirectoryContents dir =     filter (not . flip elem [".",".."]) <$>     SD.getDirectoryContents (Path.toString dir)  -- | A convenient alternative to 'relDirectoryContents' if you only want files.-filesInDir :: AbsOrRelClass ar => DirPath ar -> IO [RelFile]+filesInDir :: Class.AbsRel ar => DirPath ar -> IO [RelFile] filesInDir dir = snd <$> relDirectoryContents dir  -- | A convenient alternative to 'relDirectoryContents' if you only want directories.-dirsInDir :: AbsOrRelClass ar => DirPath ar -> IO [RelDir]+dirsInDir :: Class.AbsRel ar => DirPath ar -> IO [RelDir] dirsInDir dir = fst <$> relDirectoryContents dir   getCurrentDirectory :: IO AbsDir getCurrentDirectory = absDir <$> SD.getCurrentDirectory -setCurrentDirectory :: AbsOrRelClass ar => DirPath ar -> IO ()+setCurrentDirectory :: Class.AbsRel ar => DirPath ar -> IO () setCurrentDirectory = SD.setCurrentDirectory . Path.toString  @@ -173,25 +174,25 @@ ------------------------------------------------------------------------ -- Actions on files -removeFile :: AbsOrRelClass ar => FilePath ar -> IO ()+removeFile :: Class.AbsRel ar => FilePath ar -> IO () removeFile = SD.removeFile . Path.toString  renameFile ::-    (AbsOrRelClass ar1, AbsOrRelClass ar2) =>+    (Class.AbsRel ar1, Class.AbsRel ar2) =>     FilePath ar1 -> FilePath ar2 -> IO () renameFile p1 p2 = SD.renameFile (Path.toString p1) (Path.toString p2)  copyFile ::-    (AbsOrRelClass ar1, AbsOrRelClass ar2) =>+    (Class.AbsRel ar1, Class.AbsRel ar2) =>     FilePath ar1 -> FilePath ar2 -> IO () copyFile p1 p2 = SD.copyFile (Path.toString p1) (Path.toString p2)  canonicalizePath ::-    (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> IO (AbsPath fd)+    (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> IO (AbsPath fd) canonicalizePath p = path <$> SD.canonicalizePath (Path.toString p)  makeRelativeToCurrentDirectory ::-    (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> IO (RelPath fd)+    (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> IO (RelPath fd) makeRelativeToCurrentDirectory p =     path <$> SD.makeRelativeToCurrentDirectory (Path.toString p) @@ -202,10 +203,10 @@ ------------------------------------------------------------------------ -- Existence tests -doesFileExist :: AbsOrRelClass ar => FilePath ar -> IO Bool+doesFileExist :: Class.AbsRel ar => FilePath ar -> IO Bool doesFileExist = SD.doesFileExist . Path.toString -doesDirectoryExist :: AbsOrRelClass ar => DirPath ar -> IO Bool+doesDirectoryExist :: Class.AbsRel ar => DirPath ar -> IO Bool doesDirectoryExist = SD.doesDirectoryExist . Path.toString  @@ -213,11 +214,11 @@ -- Permissions  getPermissions ::-    (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> IO Permissions+    (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> IO Permissions getPermissions p = SD.getPermissions (Path.toString p)  setPermissions ::-    (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> Permissions -> IO ()+    (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> Permissions -> IO () setPermissions p perms = SD.setPermissions (Path.toString p) perms  @@ -225,5 +226,5 @@ -- Timestamps  getModificationTime ::-    (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> IO UTCTime+    (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> IO UTCTime getModificationTime p = convertTime <$> SD.getModificationTime (Path.toString p)
src/System/Path/IO.hs view
@@ -90,8 +90,9 @@  where +import qualified System.Path.Internal.PartClass as Class import qualified System.Path as Path-import System.Path (AbsOrRelClass, DirPath, FilePath, AbsFile, RelFile)+import System.Path (DirPath, FilePath, AbsFile, RelFile)  import qualified System.IO as SIO import System.IO (IOMode, Handle)@@ -106,36 +107,36 @@ -- Covers for System.IO functions  withFile ::-    AbsOrRelClass ar => FilePath ar -> IOMode -> (Handle -> IO r) -> IO r+    Class.AbsRel ar => FilePath ar -> IOMode -> (Handle -> IO r) -> IO r withFile f = SIO.withFile (Path.toString f) -openFile :: AbsOrRelClass ar => FilePath ar -> IOMode -> IO Handle+openFile :: Class.AbsRel ar => FilePath ar -> IOMode -> IO Handle openFile f = SIO.openFile (Path.toString f) -readFile :: AbsOrRelClass ar => FilePath ar -> IO String+readFile :: Class.AbsRel ar => FilePath ar -> IO String readFile f = SIO.readFile (Path.toString f) -writeFile :: AbsOrRelClass ar => FilePath ar -> String -> IO ()+writeFile :: Class.AbsRel ar => FilePath ar -> String -> IO () writeFile f = SIO.writeFile (Path.toString f) -appendFile :: AbsOrRelClass ar => FilePath ar -> String -> IO ()+appendFile :: Class.AbsRel ar => FilePath ar -> String -> IO () appendFile f = SIO.appendFile (Path.toString f)  withBinaryFile ::-    AbsOrRelClass ar => FilePath ar -> IOMode -> (Handle -> IO r) -> IO r+    Class.AbsRel ar => FilePath ar -> IOMode -> (Handle -> IO r) -> IO r withBinaryFile f = SIO.withBinaryFile (Path.toString f) -openBinaryFile :: AbsOrRelClass ar => FilePath ar -> IOMode -> IO Handle+openBinaryFile :: Class.AbsRel ar => FilePath ar -> IOMode -> IO Handle openBinaryFile f = SIO.openBinaryFile (Path.toString f)  openTempFile ::-    AbsOrRelClass ar => DirPath ar -> RelFile -> IO (AbsFile, Handle)+    Class.AbsRel ar => DirPath ar -> RelFile -> IO (AbsFile, Handle) openTempFile f template =     mapFst Path.absFile <$>     SIO.openTempFile (Path.toString f) (Path.toString template)  openBinaryTempFile ::-    AbsOrRelClass ar => DirPath ar -> RelFile -> IO (AbsFile, Handle)+    Class.AbsRel ar => DirPath ar -> RelFile -> IO (AbsFile, Handle) openBinaryTempFile f template =     mapFst Path.absFile <$>     SIO.openBinaryTempFile (Path.toString f) (Path.toString template)
src/System/Path/Internal.hs view
@@ -3,35 +3,26 @@   -- * The main filepath (& dirpath) abstract type   Path, -- kept abstract -  -- * Possible types for Path type parameters-  Abs,-  Rel,-  AbsOrRel,-  File,-  Dir,-  FileOrDir,-   -- * Type Synonyms   AbsFile,   RelFile,   AbsDir,   RelDir,-  AbsOrRelFile,-  AbsOrRelDir,-  AbsFileOrDir,-  RelFileOrDir,-  AbsOrRelFileOrDir,+  AbsRelFile,+  AbsRelDir,+  AbsFileDir,+  RelFileDir,+  AbsRelFileDir, -  AbsPath,-  RelPath,-  FilePath,-  DirPath,-  AbsOrRelPath,-  FileOrDirPath,+  AbsPath,     Abs,+  RelPath,     Rel,+  FilePath,    File,+  DirPath,     Dir,+  AbsRelPath,  AbsRel,+  FileDirPath, FileDir, -  -- * Classes-  AbsRelClass(..), AbsOrRelClass(..), absRel,-  FileOrDirClass(..), FileDirClass(..), fileDir,+  -- * Decisions on path types+  withAbsRel, withFileDir,    -- * Path to String conversion   toString,@@ -43,8 +34,8 @@   emptyFile,    -- * Parsing Functions-  maybePath,-  parsePath,+  maybePath, maybe,+  parsePath, parse,    -- * Checked Construction Functions   path,@@ -52,13 +43,14 @@   relDir,   absFile,   absDir,-  relPath,-  absPath,-  filePath,-  dirPath,+  relPath,    rel,+  absPath,    abs,+  filePath,   file,+  dirPath,    dir,+  absRel,     fileDir, -  idAbsOrRel, idAbs, idRel,-  idFileOrDir, idFile, idDir,+  idAbsRel, idAbs, idRel,+  idFileDir, idFile, idDir,    -- * Unchecked Construction Functions   asPath,@@ -93,12 +85,16 @@   splitExtension,   splitExtensions,   splitFileName,+  splitDirName,   takeBaseName,   takeDirectory,+  takeSuperDirectory,   takeExtension,   takeExtensions,   takeFileName,+  takeDirName,   mapFileName,+  mapFileNameF,    -- * Auxillary Manipulation Functions   equalFilePath,@@ -116,10 +112,10 @@   pathMap,   dirFromFile,   fileFromDir,-  toFileOrDir,-  fromFileOrDir,-  fileFromFileOrDir,-  dirFromFileOrDir,+  toFileDir,+  fromFileDir,+  fileFromFileDir,+  dirFromFileDir,    -- * Path Predicates   isAbsolute,@@ -152,12 +148,20 @@  where +import qualified System.Path.Internal.PartClass as Class+import qualified System.Path.Internal.Part as Part+import System.Path.Internal.PartClass as Class+        (WrapFileDir(WrapFileDir), WrapAbsRel(WrapAbsRel), FuncArg(..), fdMap)+import System.Path.Internal.Part+        (PathComponent(PathComponent), GenComponent, System(..),+         absPC, emptyPC, retagPC, untagPC, pcMap)+ import qualified System.Directory as SD  import qualified Control.Monad.Trans.Class as MT import qualified Control.Monad.Trans.State as MS import Control.Monad (MonadPlus, guard, liftM2, mplus, mzero)-import Control.Applicative (Const(Const), liftA2, (<$>))+import Control.Applicative (Const(Const), liftA2, (<$>), (<$)) import Control.DeepSeq (NFData(rnf))  import qualified Data.Monoid.HT as MonHT@@ -181,40 +185,23 @@ import Test.QuickCheck           (Gen, Property, property, Arbitrary(arbitrary), frequency) -import Prelude hiding (FilePath)+import qualified Prelude as P+import Prelude hiding (FilePath, maybe, abs)   ------------------------------------------------------------------------ -- Types -newtype Abs = Abs GenComponent-data Rel = Rel-data AbsOrRel = AbsO GenComponent | RelO--absPC :: String -> Abs-absPC = Abs . PathComponent--newtype File = File GenComponent-data Dir = Dir-data FileOrDir = FileOrDir---data Generic = Generic--_osDummy :: Generic-_osDummy = Generic-- -- | This is the main filepath abstract datatype data Path os ar fd = Path ar [PathComponent os] fd  instance-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>         Eq (Path os ar fd) where     (==)  =  equating inspectPath  instance-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>         Ord (Path os ar fd) where     compare  =  comparing inspectPath @@ -223,126 +210,44 @@ inspectPath (Path ar pcs fd) = (WrapAbsRel ar, pcs, WrapFileDir fd)  -newtype WrapAbsRel os ar = WrapAbsRel {unwrapAbsRel :: ar}--instance (System os, AbsOrRelClass ar) => Eq (WrapAbsRel os ar) where-    (==) = equating inspectAbsRel--instance (System os, AbsOrRelClass ar) => Ord (WrapAbsRel os ar) where-    compare = comparing inspectAbsRel--inspectAbsRel ::-    (AbsOrRelClass ar) =>-    WrapAbsRel os ar -> Either (PathComponent os) ()-inspectAbsRel =-    absRelPlain (Left . PathComponent) (Right ()) . unwrapAbsRel---newtype WrapFileDir os fd = WrapFileDir {unwrapFileDir :: fd}--instance (System os, FileOrDirClass fd) => Eq (WrapFileDir os fd) where-    (==) = equating inspectFileDir--instance (System os, FileOrDirClass fd) => Ord (WrapFileDir os fd) where-    compare = comparing inspectFileDir--inspectFileDir ::-    (FileOrDirClass ar) =>-    WrapFileDir os ar -> Either (PathComponent os) ()-inspectFileDir =-    fileOrDirPlain (Left . retagPC) (Right ()) (Right ()) . unwrapFileDir---{- |-We cannot have a PathComponent without phantom types plus a Tagged wrapper,-because we need specialised Eq and Ord instances.--}-type GenComponent = PathComponent Generic--newtype PathComponent os = PathComponent String--instance (System os) => Eq (PathComponent os) where-    (==)  =  equating (applyComp canonicalize)--instance (System os) => Ord (PathComponent os) where-    compare  =  comparing (applyComp canonicalize)--applyComp :: Tagged os (String -> String) -> PathComponent os -> String-applyComp (Tagged canon) (PathComponent pc) = canon pc--retagPC :: GenComponent -> PathComponent os-retagPC (PathComponent pc) = PathComponent pc--untagPC :: PathComponent os -> GenComponent-untagPC (PathComponent pc) = PathComponent pc- selTag :: Path os ar fd -> Tagged os a -> a selTag _ = untag  -type AbsFile os = Path os Abs File-type RelFile os = Path os Rel File-type AbsDir  os = Path os Abs Dir-type RelDir  os = Path os Rel Dir-type AbsOrRelFile os = Path os AbsOrRel File-type AbsOrRelDir  os = Path os AbsOrRel Dir-type AbsFileOrDir os = Path os Abs FileOrDir-type RelFileOrDir os = Path os Rel FileOrDir-type AbsOrRelFileOrDir os = Path os AbsOrRel FileOrDir--type AbsPath  os fd = Path os Abs fd-type RelPath  os fd = Path os Rel fd-type FilePath os ar = Path os ar File-type DirPath  os ar = Path os ar Dir-type AbsOrRelPath  os fd = Path os AbsOrRel fd-type FileOrDirPath os ar = Path os ar FileOrDir--instance NFData (PathComponent os) where-    rnf (PathComponent pc) = rnf pc--instance NFData Abs where-    rnf (Abs drive) = rnf drive--instance NFData Rel where-    rnf Rel = ()+type AbsFile os = Path os Part.Abs Part.File+type RelFile os = Path os Part.Rel Part.File+type AbsDir  os = Path os Part.Abs Part.Dir+type RelDir  os = Path os Part.Rel Part.Dir+type AbsRelFile os = Path os Part.AbsRel Part.File+type AbsRelDir  os = Path os Part.AbsRel Part.Dir+type AbsFileDir os = Path os Part.Abs Part.FileDir+type RelFileDir os = Path os Part.Rel Part.FileDir+type AbsRelFileDir os = Path os Part.AbsRel Part.FileDir -instance NFData File where-    rnf (File pc) = rnf pc+type Abs  os fd = Path os Part.Abs fd+type Rel  os fd = Path os Part.Rel fd+type File os ar = Path os ar Part.File+type Dir  os ar = Path os ar Part.Dir+type AbsRel  os fd = Path os Part.AbsRel fd+type FileDir os ar = Path os ar Part.FileDir -instance NFData Dir where-    rnf Dir = ()+{-# DEPRECATED RelPath     "Use Path.Rel instead." #-}+{-# DEPRECATED AbsPath     "Use Path.Abs instead." #-}+{-# DEPRECATED AbsRelPath  "Use Path.AbsRel instead." #-}+{-# DEPRECATED FilePath    "Use Path.File instead." #-}+{-# DEPRECATED DirPath     "Use Path.Dir instead." #-}+{-# DEPRECATED FileDirPath "Use Path.FileDir instead." #-} -instance NFData FileOrDir where-    rnf FileOrDir = ()+type AbsPath  os fd = Path os Part.Abs fd+type RelPath  os fd = Path os Part.Rel fd+type FilePath os ar = Path os ar Part.File+type DirPath  os ar = Path os ar Part.Dir+type AbsRelPath  os fd = Path os Part.AbsRel fd+type FileDirPath os ar = Path os ar Part.FileDir -instance (AbsOrRelClass ar, FileOrDirClass fd) => NFData (Path os ar fd) where+instance (Class.AbsRel ar, Class.FileDir fd) => NFData (Path os ar fd) where     rnf (Path ar pcs fd) =-        rnf (absRelPlain rnf () ar, pcs, fileOrDirPlain rnf () () fd)--absRelPlain :: (AbsOrRelClass ar) => (String -> a) -> a -> ar -> a-absRelPlain fAbs fRel =-    runFuncArg $-    switchAbsOrRel-        (FuncArg $ \(Abs (PathComponent drive)) -> fAbs drive)-        (FuncArg $ \Rel -> fRel)-        (FuncArg $ \ar ->-            case ar of-                AbsO (PathComponent drive) -> fAbs drive-                RelO -> fRel)--fileDirPlain :: (FileDirClass fd) => (GenComponent -> a) -> a -> fd -> a-fileDirPlain fFile fDir =-    runFuncArg $-    switchFileDir (FuncArg $ \(File pc) -> fFile pc) (FuncArg $ \Dir -> fDir)--fileOrDirPlain ::-    (FileOrDirClass fd) => (GenComponent -> a) -> a -> a -> fd -> a-fileOrDirPlain fFile fDir fFileOrDir =-    runFuncArg $-    switchFileOrDir (FuncArg $ \(File pc) -> fFile pc)-        (FuncArg $ \Dir -> fDir) (FuncArg $ \FileOrDir -> fFileOrDir)--newtype FuncArg b a = FuncArg {runFuncArg :: a -> b}+        rnf (Class.withAbsRel rnf () ar, pcs, Class.withFileDir rnf () () fd)  -- I don't think this basic type of fold is appropriate for a nested datatype -- pathFold :: a -> (a -> String -> a) -> Path ar fd -> a@@ -353,130 +258,66 @@ -- -- >> Path.pathMap (map toLower) (absDir "/tmp/Reports/SpreadSheets") == Posix.absDir "/tmp/reports/spreadsheets" pathMap ::-    (FileOrDirClass fd) => (String -> String) -> Path os ar fd -> Path os ar fd+    (Class.FileDir fd) => (String -> String) -> Path os ar fd -> Path os ar fd pathMap f (Path ar pcs fd) = Path ar (map (pcMap f) pcs) (fdMap f fd) -fdMap :: (FileOrDirClass fd) => (String -> String) -> fd -> fd-fdMap f = appEndo $ switchFileOrDir (Endo $ fileMap f) (Endo id) (Endo id) -fileMap :: (String -> String) -> File -> File-fileMap f (File pc) = File $ pcMap f pc--pcMap :: (String -> String) -> PathComponent os -> PathComponent os-pcMap f (PathComponent s) = PathComponent (f s)-- mapFilePart ::     (GenComponent -> GenComponent) -> FilePath os ar -> FilePath os ar-mapFilePart f (Path ar pcs (File fd)) = Path ar pcs $ File $ f fd+mapFilePart f (Path ar pcs (Part.File fd)) = Path ar pcs $ Part.File $ f fd +mapFilePartF ::+    (Functor f) =>+    (GenComponent -> f GenComponent) -> FilePath os ar -> f (FilePath os ar)+mapFilePartF f (Path ar pcs (Part.File fd)) =+    Path ar pcs <$> Part.File <$> f fd+ splitFilePart ::     (GenComponent -> (GenComponent, a)) -> FilePath os ar -> (FilePath os ar, a)-splitFilePart f (Path ar pcs (File fd)) = mapFst (Path ar pcs . File) $ f fd+splitFilePart f (Path ar pcs (Part.File fd)) = mapFst (Path ar pcs . Part.File) $ f fd  mapPathDirs ::     ([PathComponent os] -> [PathComponent os]) -> Path os ar fd -> Path os ar fd mapPathDirs f ~(Path ar pcs fd) = Path ar (f pcs) fd  ---------------------------------------------------------------------------- Type classes and machinery for switching on Abs/Rel and File/Dir---- | This class provides a way to prevent other modules---   from making further 'AbsRelClass' or 'FileDirClass'---   instances-class Private p-instance Private Abs-instance Private Rel-instance Private AbsOrRel-instance Private File-instance Private Dir-instance Private FileOrDir---- | This class allows selective behaviour for absolute and---   relative paths and is mostly for internal use.-class Private ar => AbsOrRelClass ar where-    {- |-    See <https://wiki.haskell.org/Closed_world_instances>-    for the used technique.-    -}-    switchAbsOrRel :: f Abs -> f Rel -> f AbsOrRel -> f ar--instance AbsOrRelClass Abs where switchAbsOrRel f _ _ = f-instance AbsOrRelClass Rel where switchAbsOrRel _ f _ = f-instance AbsOrRelClass AbsOrRel where switchAbsOrRel _ _ f = f--class AbsOrRelClass ar => AbsRelClass ar where-    switchAbsRel :: f Abs -> f Rel -> f ar--instance AbsRelClass Abs where switchAbsRel f _ = f-instance AbsRelClass Rel where switchAbsRel _ f = f--absRel ::-    (AbsOrRelClass ar) =>+withAbsRel ::+    (Class.AbsRel ar) =>     (AbsPath os fd -> a) -> (RelPath os fd -> a) -> Path os ar fd -> a-absRel fAbs fRel (Path ar pcs fd) =-    absRelPlain-        (\drive -> fAbs $ Path (Abs (PathComponent drive)) pcs fd)-        (fRel $ Path Rel pcs fd)+withAbsRel fAbs fRel (Path ar pcs fd) =+    Class.withAbsRel+        (\drive -> fAbs $ Path (Part.Abs (PathComponent drive)) pcs fd)+        (fRel $ Path Part.Rel pcs fd)         ar -class AbsRelClass ar => IsAbs ar where switchAbs :: f Abs -> f ar-instance IsAbs Abs where switchAbs = id--class AbsRelClass ar => IsRel ar where switchRel :: f Rel -> f ar-instance IsRel Rel where switchRel = id----- | This class allows selective behaviour for file and---   directory paths and is mostly for internal use.-class Private fd => FileOrDirClass fd where-    switchFileOrDir :: f File -> f Dir -> f FileOrDir -> f fd--instance FileOrDirClass File      where switchFileOrDir f _ _ = f-instance FileOrDirClass Dir       where switchFileOrDir _ f _ = f-instance FileOrDirClass FileOrDir where switchFileOrDir _ _ f = f--switchFileOrDirPath ::-    (FileOrDirClass fd) =>-    f (FilePath os ar) -> f (DirPath os ar) -> f (FileOrDirPath os ar) ->+switchFileDir ::+    (Class.FileDir fd) =>+    f (FilePath os ar) -> f (DirPath os ar) -> f (FileDirPath os ar) ->     f (Path os ar fd)-switchFileOrDirPath f d fd =-    getCompose $ switchFileOrDir (Compose f) (Compose d) (Compose fd)--class FileOrDirClass fd => FileDirClass fd where-    switchFileDir :: f File -> f Dir -> f fd--instance FileDirClass File where switchFileDir f _ = f-instance FileDirClass Dir  where switchFileDir _ f = f+switchFileDir f d fd =+    getCompose $ Class.switchFileDir (Compose f) (Compose d) (Compose fd) -switchFileDirPath ::-    (FileDirClass fd) =>+switchFileOrDir ::+    (Class.FileOrDir fd) =>     f (FilePath os ar) -> f (DirPath os ar) -> f (Path os ar fd)-switchFileDirPath f d =-    getCompose $ switchFileDir (Compose f) (Compose d)+switchFileOrDir f d =+    getCompose $ Class.switchFileOrDir (Compose f) (Compose d) -fileDir ::-    (FileDirClass fd) =>+withFileDir ::+    (Class.FileOrDir fd) =>     (FilePath os ar -> a) -> (DirPath os ar -> a) -> Path os ar fd -> a-fileDir f g = runFuncArg $ switchFileDirPath (FuncArg f) (FuncArg g)--class FileDirClass fd => IsFile fd where switchFile :: f File -> f fd-instance IsFile File where switchFile = id--class FileDirClass fd => IsDir fd where switchDir :: f Dir -> f fd-instance IsDir Dir where switchDir = id+withFileDir f g = runFuncArg $ switchFileOrDir (FuncArg f) (FuncArg g)   -- | Currently not exported-_eitherFromAbsRel ::-    AbsOrRelClass ar => Path os ar fd -> Either (AbsPath os fd) (RelPath os fd)-_eitherFromAbsRel = absRel Left Right+eitherFromAbsRel ::+    Class.AbsRel ar => Path os ar fd -> Either (AbsPath os fd) (RelPath os fd)+eitherFromAbsRel = withAbsRel Left Right  -- | Currently not exported _eitherFromFileDir ::-    FileDirClass fd => Path os ar fd -> Either (FilePath os ar) (DirPath os ar)-_eitherFromFileDir = fileDir Left Right+    Class.FileOrDir fd => Path os ar fd -> Either (FilePath os ar) (DirPath os ar)+_eitherFromFileDir = withFileDir Left Right  ------------------------------------------------------------------------ -- Read & Show instances@@ -484,8 +325,8 @@ {- | We show and parse file path components using the rather generic 'relPath' smart constructor-instead of 'relFile', 'relDir' and @relPath str :: FileOrDirPath ar@.-Otherwise handling of all cases of 'File', 'Dir' and 'FileOrDir' types+instead of 'relFile', 'relDir' and @relPath str :: FileDirPath ar@.+Otherwise handling of all cases of 'Part.File', 'Part.Dir' and 'Part.FileDir' types becomes pretty complicated. -} -- >> show (Posix.rootDir </> relDir "bla" </> relFile "blub") == "rootDir </> relPath \"bla\" </> relPath \"blub\""@@ -495,12 +336,12 @@ -- >> show (Windows.absDir "c:" </> relDir "bla" </> relFile "blub") == "absDir \"c:\" </> relPath \"bla\" </> relPath \"blub\"" -- >> show (Just (Windows.absDir "c:\\" </> relDir "bla" </> relFile "blub")) == "Just (absDir \"c:\\\\\" </> relPath \"bla\" </> relPath \"blub\")" instance-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>         Show (Path os ar fd) where     showsPrec = untag showsPrecTagged  showsPrecTagged ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     Tagged os (Int -> Path os ar fd -> ShowS) showsPrecTagged =     flip fmap rootStringTagged $ \root d x ->@@ -509,7 +350,7 @@                 showParen (d>5) $ concatS $                 intersperse                     (showChar ' ' . showString combineOperator . showChar ' ') $-                absRelPlain+                Class.withAbsRel                     (\drive ->                         if drive == root                           then showString rootName@@ -522,7 +363,7 @@ showsCons name arg  =  showString name . showChar ' ' . showsPrec 11 arg  {- |-Currently it also parses AbsOrRel and FileOrDir paths,+Currently it also parses Part.AbsRel and Part.FileDir paths, although these cannot be composed with the accepted combinators. -} -- >> read "rootDir" == Posix.rootDir@@ -537,12 +378,12 @@ -- >> let path = Just (Windows.rootDir </> relDir "bla" </> relFile "blub") in read (show path) == path -- >> let path = Windows.absDir "c:" </> relDir "bla" </> relFile "blub" in read (show path) == path instance-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>         Read (Path os ar fd) where     readsPrec d = readParen (d>5) $ untag readsPrecTagged  readsPrecTagged ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     Tagged os (ReadS (Path os ar fd)) readsPrecTagged =     flip fmap readsSplitDrive $ \readsSplDrv ->@@ -576,55 +417,57 @@  matchString :: (MonadPlus m) => String -> MS.StateT String m () matchString prefix =-    MS.StateT $ maybe mzero (return . (,) ()) . stripPrefix prefix+    MS.StateT $ P.maybe mzero (return . (,) ()) . stripPrefix prefix  readsSplitDrive ::-    (System os, AbsOrRelClass ar) => Tagged os (MS.StateT String [] ar)+    (System os, Class.AbsRel ar) => Tagged os (MS.StateT String [] ar) readsSplitDrive =     flip fmap readsSplitDriveAbs $ \readsSplDrvAbs ->-        switchAbsOrRel+        Class.switchAbsRel             readsSplDrvAbs             readsSplitDriveRel             (mplus-                (fmap (\(Abs drive) -> AbsO drive) readsSplDrvAbs)-                (fmap (\Rel -> RelO) readsSplitDriveRel))+                (fmap (\(Part.Abs drive) -> Part.AbsO drive) readsSplDrvAbs)+                (fmap (\Part.Rel -> Part.RelO) readsSplitDriveRel)) -readsSplitDriveAbs :: (System os) => Tagged os (MS.StateT String [] Abs)+readsSplitDriveAbs :: (System os) => Tagged os (MS.StateT String [] Part.Abs) readsSplitDriveAbs =     flip fmap rootStringTagged $ \root ->         fmap absPC $-            (matchString rootName >> return root)+            (root <$ matchString rootName)             `mplus`             readsCons absDirName -readsSplitDriveRel :: (MonadPlus m) => MS.StateT String m Rel-readsSplitDriveRel = matchString currentName >> return Rel+readsSplitDriveRel :: (MonadPlus m) => MS.StateT String m Part.Rel+readsSplitDriveRel = matchString currentName >> return Part.Rel  --- | Synonym of 'getPathString' intended for qualified use.+-- | Convert the 'Path' into a plain 'String' as required for OS calls. toString ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) => Path os ar fd -> String-toString = getPathString+    (System os, Class.AbsRel ar, Class.FileDir fd) => Path os ar fd -> String+toString = flip toStringS "" --- | Convert the 'Path' into a plain 'String' as required for OS calls.+{-# DEPRECATED getPathString "Use Path.toString instead." #-}++-- | Synonym of 'toString' intended for unqualified use. getPathString ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) => Path os ar fd -> String-getPathString = flip getPathStringS ""+    (System os, Class.AbsRel ar, Class.FileDir fd) => Path os ar fd -> String+getPathString = toString -getPathStringS ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) => Path os ar fd -> ShowS-getPathStringS x =+toStringS ::+    (System os, Class.AbsRel ar, Class.FileDir fd) => Path os ar fd -> ShowS+toStringS x =     case pathComponents x of         (ar, []) ->-            absRelPlain showString (showString currentDirComponent) ar+            Class.withAbsRel showString (showString currentDirComponent) ar         (ar, pcs) ->             concatS $-            absRelPlain (\drive -> (showString drive :)) id ar $+            Class.withAbsRel (\drive -> (showString drive :)) id ar $             intersperse (showChar (selTag x pathSeparator)) $             map (\(PathComponent pc) -> showString pc) pcs -prop_asPath_getPathString :: (System os) => AbsFile os -> Property-prop_asPath_getPathString p = property $ p == asPath (getPathString p)+prop_asPath_toString :: (System os) => AbsFile os -> Property+prop_asPath_toString p = property $ p == asPath (toString p)   ------------------------------------------------------------------------@@ -636,7 +479,7 @@ rootDir = untag rootDirTagged  rootDirTagged :: (System os) => Tagged os (AbsDir os)-rootDirTagged = fmap (\root -> Path (absPC root) [] Dir) rootStringTagged+rootDirTagged = fmap (\root -> Path (absPC root) [] Part.Dir) rootStringTagged  rootStringTagged :: (System os) => Tagged os String rootStringTagged = fmap (\sep -> [sep]) pathSeparator@@ -644,7 +487,7 @@ -- >> Posix.toString Path.currentDir == "." -- >> Windows.toString Path.currentDir == "." currentDir :: (System os) => RelDir os-currentDir = Path Rel [] Dir+currentDir = mempty  {- | This is a file with path @\"\"@.@@ -654,10 +497,10 @@ when manipulating extensions of files like @\".bashrc\"@. -} emptyFile :: (System os) => RelFile os-emptyFile = Path Rel [] $ File emptyPC+emptyFile = atomicFile $ Part.File emptyPC -emptyPC :: PathComponent os-emptyPC = PathComponent ""+atomicFile :: Part.File -> RelFile os+atomicFile = Path Part.Rel []  rootName :: String rootName = "rootDir"@@ -678,6 +521,9 @@ ------------------------------------------------------------------------ -- Parsing Functions +{-# DEPRECATED maybePath "Use Path.maybe instead." #-}+{-# DEPRECATED parsePath "Use Path.parse instead." #-}+ -- | This function is intended for checking and parsing paths --   provided as user input. --@@ -693,8 +539,8 @@ -- >> fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsFile) == Nothing -- >> fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.RelDir) == Nothing -- >> fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.RelFile) == Nothing--- >> fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsOrRelFileOrDir) == Just "/tmp"--- >> fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsOrRelFileOrDir) == Just "/tmp"+-- >> fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsRelFileDir) == Just "/tmp"+-- >> fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsRelFileDir) == Just "/tmp" -- >> fmap Posix.toString (Posix.maybePath "file.txt" :: Maybe Posix.RelFile) == Just "file.txt" -- >> fmap Posix.toString (Posix.maybePath "file.txt" :: Maybe Posix.AbsFile) == Nothing -- >> fmap Windows.toString (Windows.maybePath "\\tmp" :: Maybe Windows.AbsDir) == Just "\\tmp"@@ -707,41 +553,44 @@ -- >> fmap Windows.toString (Windows.maybePath "a:\\tmp" :: Maybe Windows.RelDir) == Nothing -- >> fmap Windows.toString (Windows.maybePath "a:tmp" :: Maybe Windows.RelDir) == Nothing -- >> fmap Windows.toString (Windows.maybePath "tmp" :: Maybe Windows.AbsDir) == Nothing-maybePath ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+maybe, maybePath ::+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     String -> Maybe (Path os ar fd)-maybePath str = do+maybe str = do     let (ar0, pcs0, fd0) = untag makePathComponents str     ar <-         case ar0 of-            AbsO pc -> switchAbsOrRel (Just $ Abs pc) Nothing (Just ar0)-            RelO -> switchAbsOrRel Nothing (Just Rel) (Just ar0)+            Part.AbsO pc -> Class.switchAbsRel (Just $ Part.Abs pc) Nothing (Just ar0)+            Part.RelO -> Class.switchAbsRel Nothing (Just Part.Rel) (Just ar0)     (pcs, fd) <-         case fd0 of-            Left FileOrDir -> arrangeComponents pcs0-            Right Dir ->+            Left Part.FileDir -> arrangeComponents pcs0+            Right Part.Dir ->                 fmap ((,) pcs0) $-                switchFileOrDir Nothing (Just Dir) (Just FileOrDir)+                Class.switchFileDir Nothing (Just Part.Dir) (Just Part.FileDir)     return $ Path ar pcs fd -parsePath ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+maybePath = maybe++parse, parsePath ::+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     String -> Either String (Path os ar fd)-parsePath = pathWithNames arName fdName+parse = pathWithNames arName fdName+parsePath = parse  pathWithNames ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     Const String ar -> Const String fd ->     String -> Either String (Path os ar fd) pathWithNames (Const ar) (Const fd) str =-    maybe (Left (printf "\"%s\" is not a valid %s%spath" str ar fd)) Right $+    P.maybe (Left (printf "\"%s\" is not a valid %s%spath" str ar fd)) Right $     maybePath str -arName :: (AbsOrRelClass ar) => Const String ar-arName = switchAbsOrRel (Const "absolute ") (Const "relative ") (Const "")+arName :: (Class.AbsRel ar) => Const String ar+arName = Class.switchAbsRel (Const "absolute ") (Const "relative ") (Const "") -fdName :: (FileOrDirClass fd) => Const String fd-fdName = switchFileOrDir (Const "file ") (Const "directory ") (Const "")+fdName :: (Class.FileDir fd) => Const String fd+fdName = Class.switchFileDir (Const "file ") (Const "directory ") (Const "")  ------------------------------------------------------------------------ -- Checked Construction Functions@@ -749,7 +598,7 @@ -- | This function is intended for converting path strings --   with known content, e.g. string literals, to the 'Path' type. path ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     String -> Path os ar fd path = either error id . parsePath @@ -782,26 +631,56 @@ absDir :: (System os) => String -> AbsDir os absDir = path +-- | Construct a 'Rel fd' from a 'String'.+rel :: (System os, Class.FileDir fd) => String -> Rel os fd+rel = path++-- | Construct an 'Abs fd' from a 'String'.+abs :: (System os, Class.FileDir fd) => String -> Abs os fd+abs = path++-- | Construct an 'AbsRel fd' from a 'String'.+absRel :: (System os, Class.FileDir fd) => String -> AbsRel os fd+absRel = path++-- | Construct a 'File ar' from a 'String'.+file :: (System os, Class.AbsRel ar) => String -> File os ar+file = path++-- | Construct a 'Dir ar' from a 'String'.+dir :: (System os, Class.AbsRel ar) => String -> Dir os ar+dir = path++-- | Construct a 'FileDir ar' from a 'String'.+fileDir :: (System os, Class.AbsRel ar) => String -> FileDir os ar+fileDir = path+++{-# DEPRECATED relPath    "Use Path.rel instead." #-}+{-# DEPRECATED absPath    "Use Path.abs instead." #-}+{-# DEPRECATED filePath   "Use Path.file instead." #-}+{-# DEPRECATED dirPath    "Use Path.dir instead." #-}+ -- | Construct a 'RelPath fd' from a 'String'.-relPath :: (System os, FileOrDirClass fd) => String -> RelPath os fd+relPath :: (System os, Class.FileDir fd) => String -> RelPath os fd relPath = path  -- | Construct an 'AbsPath fd' from a 'String'.-absPath :: (System os, FileOrDirClass fd) => String -> AbsPath os fd+absPath :: (System os, Class.FileDir fd) => String -> AbsPath os fd absPath = path  -- | Construct a 'FilePath ar' from a 'String'.-filePath :: (System os, AbsOrRelClass ar) => String -> FilePath os ar+filePath :: (System os, Class.AbsRel ar) => String -> FilePath os ar filePath = path  -- | Construct a 'DirPath ar' from a 'String'.-dirPath :: (System os, AbsOrRelClass ar) => String -> DirPath os ar+dirPath :: (System os, Class.AbsRel ar) => String -> DirPath os ar dirPath = path   -idAbsOrRel :: AbsOrRelPath os fd -> AbsOrRelPath os fd-idAbsOrRel = id+idAbsRel :: AbsRelPath os fd -> AbsRelPath os fd+idAbsRel = id  idAbs :: AbsPath os fd -> AbsPath os fd idAbs = id@@ -810,8 +689,8 @@ idRel = id  -idFileOrDir :: FileOrDirPath os fd -> FileOrDirPath os fd-idFileOrDir = id+idFileDir :: FileDirPath os fd -> FileDirPath os fd+idFileDir = id  idFile :: FilePath os fd -> FilePath os fd idFile = id@@ -854,7 +733,7 @@ -- >> Windows.toString (Windows.asPath "a:tmp" :: Windows.AbsDir) == "a:tmp" -- >> Windows.toString (Windows.asPath "tmp" :: Windows.RelDir) == "tmp" asPath ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) => String -> Path os ar fd+    (System os, Class.AbsRel ar, Class.FileDir fd) => String -> Path os ar fd asPath = uncurry mkPathFromComponents . untag mkPathComponents  @@ -892,19 +771,19 @@ asAbsDir = asPath  -- | Use a 'String' as a 'RelPath fd'. No checking is done.-asRelPath :: (System os, FileOrDirClass fd) => String -> RelPath os fd+asRelPath :: (System os, Class.FileDir fd) => String -> RelPath os fd asRelPath = asPath  -- | Use a 'String' as an 'AbsPath fd'. No checking is done.-asAbsPath :: (System os, FileOrDirClass fd) => String -> AbsPath os fd+asAbsPath :: (System os, Class.FileDir fd) => String -> AbsPath os fd asAbsPath = asPath  -- | Use a 'String' as a 'FilePath ar'. No checking is done.-asFilePath :: (System os, AbsOrRelClass ar) => String -> FilePath os ar+asFilePath :: (System os, Class.AbsRel ar) => String -> FilePath os ar asFilePath = asPath  -- | Use a 'String' as a 'DirPath ar'. No checking is done.-asDirPath :: (System os, AbsOrRelClass ar) => String -> DirPath os ar+asDirPath :: (System os, Class.AbsRel ar) => String -> DirPath os ar asDirPath = asPath  -- | Forbid use of OverloadedStrings and prevent custom orphan instances@@ -915,12 +794,14 @@ class System os => ForbiddenSystem os where     forbiddenFromString :: String -> Path os ar fd -class AbsRelClass ar => ForbiddenAbsRel ar where-class FileDirClass fd => ForbiddenFileDir fd where+class Class.AbsRel ar => ForbiddenAbsRel ar where+class Class.FileDir fd => ForbiddenFileDir fd where  ------------------------------------------------------------------------ -- Checked Construction Functions +{-# DEPRECATED mkPathAbsOrRel "Use Path.absRel instead." #-}+ -- | Examines the supplied string and constructs an absolute or -- relative path as appropriate. --@@ -930,77 +811,78 @@ -- >> Path.mkPathAbsOrRel "d:\\tmp" == Left (Windows.absDir "d:\\tmp") -- >> Path.mkPathAbsOrRel "d:tmp" == Left (Windows.absDir "d:tmp") -- >> Path.mkPathAbsOrRel "tmp" == Right (Windows.relDir "tmp")-mkPathAbsOrRel ::-    (System os, FileOrDirClass fd) =>+mkPathAbsOrRel, mkPathAbsOrRelPriv ::+    (System os, Class.FileDir fd) =>     String -> Either (AbsPath os fd) (RelPath os fd)-mkPathAbsOrRel = eitherAbsOrRel . asPath+mkPathAbsOrRel = mkPathAbsOrRelPriv+mkPathAbsOrRelPriv = eitherFromAbsRel . absRel -eitherAbsOrRel :: AbsOrRelPath os fd -> Either (AbsPath os fd) (RelPath os fd)-eitherAbsOrRel (Path ar pcs fd) =-    case ar of-        AbsO drive -> Left $ Path (Abs drive) pcs fd-        RelO -> Right $ Path Rel pcs fd+{-# DEPRECATED mkPathFileOrDir "Don't let the path type depend on current file system content. Instead choose the path type according to the needed disk object type." #-}  -- | Searches for a file or directory with the supplied path string---   and returns a 'File' or 'Dir' path as appropriate. If neither exists+--   and returns a 'Part.File' or 'Part.Dir' path as appropriate. If neither exists --   at the supplied path, 'Nothing' is returned. mkPathFileOrDir ::-    (System os, AbsOrRelClass ar) =>+    (System os, Class.AbsRel ar) =>     String -> IO (Maybe (Either (FilePath os ar) (DirPath os ar))) mkPathFileOrDir s = do   isfile <- SD.doesFileExist s   isdir <- SD.doesDirectoryExist s   case (isfile, isdir) of     (False, False) -> return Nothing-    (True,  False) -> return $ Just $ Left $ asPath s-    (False, True ) -> return $ Just $ Right $ asPath s+    (True,  False) -> return $ Just $ Left $ path s+    (False, True ) -> return $ Just $ Right $ path s     (True,  True ) -> ioError $ userError "mkPathFileOrDir - object type changed while checking" +{-# DEPRECATED mkAbsPath "Use Path.dynamicMakeAbsolute instead." #-}+ -- | Convert a 'String' into an 'AbsPath' by interpreting it as --   relative to the supplied directory if necessary. -- -- >> Path.mkAbsPath (absDir "/tmp") "foo.txt" == Posix.absFile "/tmp/foo.txt" -- >> Path.mkAbsPath (absDir "/tmp") "/etc/foo.txt" == Posix.absFile "/etc/foo.txt" mkAbsPath ::-    (System os, FileOrDirClass fd) => AbsDir os -> String -> AbsPath os fd-mkAbsPath d = either id (makeAbsolute d) . mkPathAbsOrRel+    (System os, Class.FileDir fd) => AbsDir os -> String -> AbsPath os fd+mkAbsPath d = either id (makeAbsolute d) . mkPathAbsOrRelPriv +{-# DEPRECATED mkAbsPathFromCwd "Use Path.dynamicMakeAbsoluteFromCwd instead." #-}+ -- | Convert a 'String' into an 'AbsPath' by interpreting it as --   relative to the cwd if necessary. mkAbsPathFromCwd ::-    (System os, FileOrDirClass fd) => String -> IO (AbsPath os fd)-mkAbsPathFromCwd = either return makeAbsoluteFromCwd . mkPathAbsOrRel+    (System os, Class.FileDir fd) => String -> IO (AbsPath os fd)+mkAbsPathFromCwd = either return makeAbsoluteFromCwd . mkPathAbsOrRelPriv   ------------------------------------------------------------------------ -- Internal Functions for GenComponent manipulation  mkPathFromComponents ::-    (FileOrDirClass fd) => ar -> [PathComponent os] -> Path os ar fd+    (Class.FileDir fd) => ar -> [PathComponent os] -> Path os ar fd mkPathFromComponents ar pcs =     uncurry (Path ar) $-    switchFileOrDir-        (mapSnd File $+    Class.switchFileDir+        (mapSnd Part.File $          ListHT.switchR ([], emptyPC) (curry $ mapSnd untagPC) pcs)-        (pcs, Dir)-        (pcs, FileOrDir)+        (pcs, Part.Dir)+        (pcs, Part.FileDir)  maybePathFromComponents ::-    (FileOrDirClass fd) => ar -> [PathComponent os] -> Maybe (Path os ar fd)+    (Class.FileDir fd) => ar -> [PathComponent os] -> Maybe (Path os ar fd) maybePathFromComponents ar pcs =     fmap (uncurry $ Path ar) $ arrangeComponents pcs  arrangeComponents ::-    (FileOrDirClass fd) => [PathComponent os] -> Maybe ([PathComponent os], fd)+    (Class.FileDir fd) => [PathComponent os] -> Maybe ([PathComponent os], fd) arrangeComponents pcs =     getCompose $-    switchFileOrDir-        (Compose $ fmap (mapSnd (File . untagPC)) $ ListHT.viewR pcs)-        (Compose $ Just (pcs, Dir))-        (Compose $ Just (pcs, FileOrDir))+    Class.switchFileDir+        (Compose $ fmap (mapSnd (Part.File . untagPC)) $ ListHT.viewR pcs)+        (Compose $ Just (pcs, Part.Dir))+        (Compose $ Just (pcs, Part.FileDir))  mkPathComponents ::-    (System os, AbsOrRelClass ar) =>+    (System os, Class.AbsRel ar) =>     Tagged os (String -> (ar, [PathComponent os])) mkPathComponents =     liftA2@@ -1015,7 +897,7 @@ -} makePathComponents ::     (System os) =>-    Tagged os (String -> (AbsOrRel, [PathComponent os], Either FileOrDir Dir))+    Tagged os (String -> (Part.AbsRel, [PathComponent os], Either Part.FileDir Part.Dir)) makePathComponents =     liftA2         (\isSep splAbsolute str ->@@ -1024,11 +906,11 @@                     MS.runState splAbsolute str                 (pcs1, fd) =                     case ListHT.viewR pct of-                        Nothing -> ([], Right Dir)+                        Nothing -> ([], Right Part.Dir)                         Just (pcs, pc) ->                             if null pc -- caused by trailing slash-                              then (pcs, Right Dir)-                              else (pct, Left FileOrDir)+                              then (pcs, Right Part.Dir)+                              else (pct, Left Part.FileDir)             in  (ar, nonEmptyComponents pcs1, fd))         isPathSeparator splitAbsoluteO @@ -1036,11 +918,11 @@ nonEmptyComponents = map PathComponent . filter (not . null)  splitDriveOS ::-    (System os, AbsOrRelClass ar) => Tagged os (MS.State String ar)+    (System os, Class.AbsRel ar) => Tagged os (MS.State String ar) splitDriveOS =     liftA2         (\splDrive splAbsolute ->-            switchAbsOrRel (fmap absPC splDrive) (return Rel) splAbsolute)+            Class.switchAbsRel (fmap absPC splDrive) (return Part.Rel) splAbsolute)         splitDriveAbs splitAbsoluteO  splitDriveAbs :: (System os) => Tagged os (MS.State String String)@@ -1057,16 +939,16 @@                       else return drive)         isPathSeparator splitDrive -splitAbsoluteO :: (System os) => Tagged os (MS.State String AbsOrRel)+splitAbsoluteO :: (System os) => Tagged os (MS.State String Part.AbsRel) splitAbsoluteO =-    fmap (\drive -> if null drive then RelO else AbsO $ PathComponent drive)+    fmap (\drive -> if null drive then Part.RelO else Part.AbsO $ PathComponent drive)     <$>     splitAbsolute  pathComponents ::-    (FileOrDirClass fd) => Path os ar fd -> (ar, [PathComponent os])+    (Class.FileDir fd) => Path os ar fd -> (ar, [PathComponent os]) pathComponents (Path ar pcs fd) =-    (ar, pcs ++ fileOrDirPlain ((:[]) . retagPC) [] [] fd)+    (ar, pcs ++ Class.withFileDir ((:[]) . retagPC) [] [] fd)  prop_mkPathFromComponents_pathComponents :: (System os) => AbsDir os -> Property prop_mkPathFromComponents_pathComponents p =@@ -1081,18 +963,12 @@ combineOperator = "</>"  -instance (IsRel ar, IsDir fd) => Monoid (Path os ar fd) where-    mempty = Path relVar [] dirVar-    mappend (Path rel pcs0 _dir) (Path _rel pcs1 dir) =-        Path rel (pcs0 ++ pcs1) dir+instance (Class.Rel ar, Class.Dir fd) => Monoid (Path os ar fd) where+    mempty = Path Class.relVar [] Class.dirVar+    mappend (Path r pcs0 _dir) (Path _rel pcs1 d) = Path r (pcs0 ++ pcs1) d     mconcat paths =-        Path relVar (concatMap (\(Path _rel pcs _dir) -> pcs) paths) dirVar--relVar :: IsRel ar => ar-relVar = unwrapAbsRel $ switchRel $ WrapAbsRel Rel--dirVar :: IsDir fd => fd-dirVar = unwrapFileDir $ switchDir $ WrapFileDir Dir+        Path Class.relVar+            (concatMap (\(Path _rel pcs _dir) -> pcs) paths) Class.dirVar   -- | Infix variant of 'combine'.@@ -1107,7 +983,7 @@ -- >> Windows.toString (Windows.absDir "c:" </> Windows.relDir "tmp" </> Windows.relFile "file.txt") == "c:tmp\\file.txt" -- >> Windows.toString (Windows.relDir "dir" </> Windows.relFile "file.txt") == "dir\\file.txt" (</>) :: DirPath os ar -> RelPath os fd -> Path os ar fd-Path ar pcs0 Dir  </>  Path Rel pcs1 fd  =  Path ar (pcs0 ++ pcs1) fd+Path ar pcs0 Part.Dir  </>  Path Part.Rel pcs1 fd  =  Path ar (pcs0 ++ pcs1) fd  infixr 5  </> @@ -1212,12 +1088,20 @@ prop_split_combineExt p = property $ p == uncurry (<.>) (splitExtension p)  splitFileName :: FilePath os ar -> (DirPath os ar, RelFile os)-splitFileName (Path ar pcs fd) = (Path ar pcs Dir, Path Rel [] fd)+splitFileName (Path ar pcs fd) = (Path ar pcs Part.Dir, atomicFile fd)  prop_split_combine :: (System os) => AbsFile os -> Property prop_split_combine p = property $ uncurry combine (splitFileName p) == p +splitDirName :: DirPath os ar -> Maybe (DirPath os ar, RelDir os)+splitDirName = fmap (mapSnd dirFromFile . splitFileName) . fileFromDir +prop_splitDir_combine :: (System os) => AbsDir os -> Property+prop_splitDir_combine p =+    property $+    (uncurry combine <$> splitDirName p) == toMaybe (not $ isDrive p) p++ -- | Get the basename of a file -- -- >> Path.takeBaseName (absFile "/tmp/somedir/myfile.txt") == Posix.relFile "myfile"@@ -1229,6 +1113,16 @@ takeDirectory :: FilePath os ar -> DirPath os ar takeDirectory = fst . splitFileName +-- >> Path.takeSuperDirectory (Posix.absDir "/tmp/somedir") == Just (absDir "/tmp")+-- >> Path.takeSuperDirectory (Posix.absDir "/tmp/") == Just (absDir "/")+-- >> Path.takeSuperDirectory (Posix.absDir "/") == Nothing+-- >> Path.takeSuperDirectory (Posix.relDir "tmp/somedir") == Just (relDir "tmp")+-- >> Path.takeSuperDirectory (Posix.relDir "./somedir") == Just (relDir ".")+-- >> Path.takeSuperDirectory (Posix.relDir "somedir") == Just Path.currentDir+-- >> Path.takeSuperDirectory (Posix.relDir "") == Nothing+takeSuperDirectory :: DirPath os ar -> Maybe (DirPath os ar)+takeSuperDirectory = fmap takeDirectory . fileFromDir+ -- | Get the extension of a file, returns @\"\"@ for no extension, @.ext@ otherwise. -- -- >> Path.takeExtension x == snd (Path.splitExtension x)@@ -1249,16 +1143,31 @@ -- >> Path.takeFileName (relFile "./myfile.txt") == Posix.relFile "myfile.txt" -- >> Path.takeFileName (relFile "myfile.txt") == Posix.relFile "myfile.txt" takeFileName :: FilePath os ar -> RelFile os-takeFileName (Path _ _ fd) = Path Rel [] fd+takeFileName (Path _ _ fd) = atomicFile fd  prop_takeFileName_end :: (System os) => AbsFile os -> Property prop_takeFileName_end p =-    property $ getPathString (takeFileName p) `isSuffixOf` getPathString p+    property $ toString (takeFileName p) `isSuffixOf` toString p +takeDirName :: DirPath os ar -> Maybe (RelDir os)+takeDirName = fmap snd . splitDirName++prop_takeDirName_end :: (System os) => AbsDir os -> Property+prop_takeDirName_end p =+    property $+    fmap (\d -> toString d `isSuffixOf` toString p) (takeDirName p)+    ==+    toMaybe (not $ isDrive p) True+ mapFileName :: (String -> String) -> FilePath os ar -> FilePath os ar mapFileName = mapFilePart . pcMap +mapFileNameF ::+    (Functor f) =>+    (String -> f String) -> FilePath os ar -> f (FilePath os ar)+mapFileNameF = mapFilePartF . Part.pcMapF + ------------------------------------------------------------------------ -- Auxillary Manipulation Functions @@ -1283,8 +1192,8 @@  mkPathAbsOrRelTagged ::     (System os) =>-    Tagged os (String -> Either (AbsFileOrDir os) (RelFileOrDir os))-mkPathAbsOrRelTagged = Tagged mkPathAbsOrRel+    Tagged os (String -> Either (AbsFileDir os) (RelFileDir os))+mkPathAbsOrRelTagged = Tagged mkPathAbsOrRelPriv  -- | Constructs a 'RelPath' from a list of components. --   It is an unchecked error if the path components contain path separators.@@ -1292,8 +1201,8 @@ -- -- >> Path.joinPath ["tmp","someDir","dir"] == Posix.relDir "tmp/someDir/dir" -- >> Path.joinPath ["tmp","someDir","file.txt"] == Posix.relFile "tmp/someDir/file.txt"-joinPath :: (FileOrDirClass fd) => [String] -> RelPath os fd-joinPath = mkPathFromComponents Rel . map PathComponent+joinPath :: (Class.FileDir fd) => [String] -> RelPath os fd+joinPath = mkPathFromComponents Part.Rel . map PathComponent  -- | Currently just transforms: --@@ -1306,18 +1215,15 @@ -- >> Path.splitPath (Posix.absDir "/tmp/someDir/mydir.dir") == (True, map relDir ["tmp","someDir","mydir.dir"], Nothing) -- >> Path.splitPath (Posix.absFile "/tmp/someDir/myfile.txt") == (True, map relDir ["tmp","someDir"], Just $ relFile "myfile.txt") splitPath ::-    (AbsOrRelClass ar, FileDirClass fd) =>+    (Class.AbsRel ar, Class.FileOrDir fd) =>     Path os ar fd -> (Bool, [RelDir os], Maybe (RelFile os)) splitPath (Path ar pcs fd) =-    (isAbsolutePlain ar,-     map (\pc -> Path Rel [pc] Dir) pcs,+    (Class.isAbsolute ar,+     map (\pc -> Path Part.Rel [pc] Part.Dir) pcs,      maybeFileDir fd) -isAbsolutePlain :: (AbsOrRelClass ar) => ar -> Bool-isAbsolutePlain = absRelPlain (const True) False--maybeFileDir :: (FileDirClass fd) => fd -> Maybe (RelFile os)-maybeFileDir = fileDirPlain (Just . Path Rel [] . File) Nothing+maybeFileDir :: (Class.FileOrDir fd) => fd -> Maybe (RelFile os)+maybeFileDir = Class.withFileOrDir (Just . atomicFile . Part.File) Nothing  -- | This function can be used to construct a relative path by removing --   the supplied 'AbsDir' from the front. It is a runtime 'error' if the@@ -1329,26 +1235,26 @@ -- >> Path.makeRelative (absDir "c:\\tmp\\somedir") (absDir "c:\\tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir" -- >> Path.makeRelative (absDir "c:tmp\\somedir") (absDir "c:tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir" makeRelative ::-    (System os, FileOrDirClass fd) =>+    (System os, Class.FileDir fd) =>     AbsDir os -> AbsPath os fd -> RelPath os fd makeRelative relTo orig =     fromMaybe         (error $             printf "System.Path can't make (%s) relative to (%s)"-                (getPathString orig) (getPathString relTo)) $+                (toString orig) (toString relTo)) $     makeRelativeMaybe relTo orig  -- >> Path.makeRelativeMaybe (Posix.absDir "/tmp/somedir") (absFile "/tmp/anotherdir/file.txt") == Nothing -- >> Path.makeRelativeMaybe (Posix.absDir "/Tmp") (absFile "/tmp/anotherdir/file.txt") == Nothing -- >> Path.makeRelativeMaybe (Windows.absDir "\\Tmp") (absFile "\\tmp\\anotherdir\\file.txt") == Just (relFile "anotherdir\\file.txt") makeRelativeMaybe ::-    (System os, FileOrDirClass fd) =>+    (System os, Class.FileDir fd) =>     AbsDir os -> AbsPath os fd -> Maybe (RelPath os fd) makeRelativeMaybe relTo orig =     case (inspectPath relTo, inspectPath orig) of-        ((relToAR, relToPCs, WrapFileDir Dir),+        ((relToAR, relToPCs, WrapFileDir Part.Dir),          (origAR, origPCs, WrapFileDir fd)) ->-            fmap (flip (Path Rel) fd) $+            fmap (flip (Path Part.Rel) fd) $                 guard (relToAR == origAR) >> stripPrefix relToPCs origPCs  -- | Joins an absolute directory with a relative path to construct a@@ -1366,11 +1272,11 @@ makeAbsoluteFromCwd = genericMakeAbsoluteFromCwd  dynamicMakeAbsolute ::-    (System os) => AbsDir os -> AbsOrRelPath os fd -> AbsPath os fd+    (System os) => AbsDir os -> AbsRelPath os fd -> AbsPath os fd dynamicMakeAbsolute = genericMakeAbsolute  dynamicMakeAbsoluteFromCwd ::-    (System os) => AbsOrRelPath os fd -> IO (AbsPath os fd)+    (System os) => AbsRelPath os fd -> IO (AbsPath os fd) dynamicMakeAbsoluteFromCwd = genericMakeAbsoluteFromCwd  -- | As for 'makeAbsolute', but for use when the path may already be@@ -1382,13 +1288,13 @@ -- >> Path.genericMakeAbsolute (absDir "/tmp") (relFile "adir/file.txt")  == Posix.absFile "/tmp/adir/file.txt" -- >> Path.genericMakeAbsolute (absDir "/tmp") (absFile "/adir/file.txt") == Posix.absFile "/adir/file.txt" genericMakeAbsolute ::-    (System os, AbsOrRelClass ar) => AbsDir os -> Path os ar fd -> AbsPath os fd-genericMakeAbsolute base p = absRel id (base </>) p+    (System os, Class.AbsRel ar) => AbsDir os -> Path os ar fd -> AbsPath os fd+genericMakeAbsolute base p = withAbsRel id (base </>) p  -- | As for 'makeAbsoluteFromCwd', but for use when the path may already be --   absolute (in which case it is left unchanged). genericMakeAbsoluteFromCwd ::-    (System os, AbsOrRelClass ar) => Path os ar fd -> IO (AbsPath os fd)+    (System os, Class.AbsRel ar) => Path os ar fd -> IO (AbsPath os fd) genericMakeAbsoluteFromCwd p = do   cwdString <- SD.getCurrentDirectory -- we don't use System.Path.Directory impl here to avoid module cycle   return $ genericMakeAbsolute (asAbsDir cwdString) p@@ -1396,12 +1302,12 @@ prop_makeAbsoluteFromDir_endSame ::     (System os) => AbsDir os -> RelFile os -> Property prop_makeAbsoluteFromDir_endSame base p =-    property $ getPathString p `isSuffixOf` getPathString (makeAbsolute base p)+    property $ toString p `isSuffixOf` toString (makeAbsolute base p)  prop_makeAbsoluteFromDir_startSame ::     (System os) => AbsDir os -> RelFile os -> Property prop_makeAbsoluteFromDir_startSame base p =-    property $ getPathString base `isPrefixOf` getPathString (makeAbsolute base p)+    property $ toString base `isPrefixOf` toString (makeAbsolute base p)  -- prop_makeAbsoluteFromDir_startSameAbs :: AbsDir os -> AbsFile -> Property -- prop_makeAbsoluteFromDir_startSameAbs base p = property $ show base `isPrefixOf` show (makeAbsolute base p)@@ -1412,7 +1318,7 @@ --   The purpose of this function is to be an intermediate step --   when deriving a directory name from a file name. dirFromFile :: FilePath os ar -> DirPath os ar-dirFromFile p = uncurry Path (pathComponents p) Dir+dirFromFile p = uncurry Path (pathComponents p) Part.Dir  -- | Convert a directory to a file path. --   The function returns 'Nothing' if the directory path is empty.@@ -1421,26 +1327,26 @@ fileFromDir :: DirPath os ar -> Maybe (FilePath os ar) fileFromDir = fileFromAny -toFileOrDir :: (FileOrDirClass fd) => Path os ar fd -> FileOrDirPath os ar-toFileOrDir p = uncurry Path (pathComponents p) FileOrDir+toFileDir :: (Class.FileDir fd) => Path os ar fd -> FileDirPath os ar+toFileDir p = uncurry Path (pathComponents p) Part.FileDir -fromFileOrDir ::-    (FileOrDirClass fd) => FileOrDirPath os ar -> Maybe (Path os ar fd)-fromFileOrDir p =-    switchFileOrDirPath-        (fileFromFileOrDir p)-        (Just $ dirFromFileOrDir p)+fromFileDir ::+    (Class.FileDir fd) => FileDirPath os ar -> Maybe (Path os ar fd)+fromFileDir p =+    switchFileDir+        (fileFromFileDir p)+        (Just $ dirFromFileDir p)         (Just p) -fileFromFileOrDir :: FileOrDirPath os ar -> Maybe (FilePath os ar)-fileFromFileOrDir = fileFromAny+fileFromFileDir :: FileDirPath os ar -> Maybe (FilePath os ar)+fileFromFileDir = fileFromAny  fileFromAny :: Path os ar fd -> Maybe (FilePath os ar) fileFromAny (Path ar pcs _) =-    fmap (uncurry (Path ar) . mapSnd (File . untagPC)) $ ListHT.viewR pcs+    fmap (uncurry (Path ar) . mapSnd (Part.File . untagPC)) $ ListHT.viewR pcs -dirFromFileOrDir :: FileOrDirPath os ar -> DirPath os ar-dirFromFileOrDir (Path ar pcs FileOrDir) = Path ar pcs Dir+dirFromFileDir :: FileDirPath os ar -> DirPath os ar+dirFromFileDir (Path ar pcs Part.FileDir) = Path ar pcs Part.Dir   ------------------------------------------------------------------------@@ -1459,7 +1365,10 @@ makeValid        :: String   -> String -} +isDrive :: AbsDir os -> Bool+isDrive (Path _ pcs _) = null pcs + ------------------------------------------------------------------------ -- Path Predicates @@ -1469,15 +1378,15 @@ -- >> Path.isAbsolute (Windows.absFile "\\fred") -- >> Path.isAbsolute (Windows.absFile "c:\\fred") -- >> Path.isAbsolute (Windows.absFile "c:fred")-isAbsolute :: AbsOrRelClass ar => Path os ar fd -> Bool-isAbsolute = absRel (const True) (const False)+isAbsolute :: Class.AbsRel ar => Path os ar fd -> Bool+isAbsolute = withAbsRel (const True) (const False) --- | Invariant - this should return True iff arg is of type @'Path' Rel _@+-- | Invariant - this should return True iff arg is of type @'Path' Part.Rel _@ -- -- > isRelative = not . isAbsolute -- >> Path.isRelative (Posix.relFile "fred") -- >> Path.isRelative (Windows.relFile "fred")-isRelative :: AbsOrRelClass ar => Path os ar fd -> Bool+isRelative :: Class.AbsRel ar => Path os ar fd -> Bool isRelative = not . isAbsolute  @@ -1517,7 +1426,7 @@ ------------------------------------------------------------------------ -- Separators --- | File extension character+-- | Part.File extension character -- -- >> Posix.extSeparator == '.' extSeparator :: Char@@ -1557,11 +1466,11 @@ -- >> Path.genericAddExtension Path.emptyFile "x" == Posix.relFile ".x" -- >> Path.genericAddExtension Path.emptyFile "" == Posix.emptyFile genericAddExtension ::-    (FileOrDirClass fd) => Path os ar fd -> String -> Path os ar fd+    (Class.FileDir fd) => Path os ar fd -> String -> Path os ar fd genericAddExtension =     flip $ \ext ->         appEndo $ MonHT.when (not $ null ext) $-        switchFileOrDirPath+        switchFileDir             (Endo $ flip addExtension ext)             (Endo $ componentsAddExtension ext)             (Endo $ componentsAddExtension ext)@@ -1571,17 +1480,17 @@     let pcs = if null pcs0 then [emptyPC] else pcs0     in  Path ar (mapLast (flip addExtensionPC ext) pcs) fd -genericDropExtension :: (FileOrDirClass fd) => Path os ar fd -> Path os ar fd+genericDropExtension :: (Class.FileDir fd) => Path os ar fd -> Path os ar fd genericDropExtension = fst . genericSplitExtension -genericDropExtensions :: (FileOrDirClass fd) => Path os ar fd -> Path os ar fd+genericDropExtensions :: (Class.FileDir fd) => Path os ar fd -> Path os ar fd genericDropExtensions = fst . genericSplitExtensions  genericSplitExtension ::-    (FileOrDirClass fd) => Path os ar fd -> (Path os ar fd, String)+    (Class.FileDir fd) => Path os ar fd -> (Path os ar fd, String) genericSplitExtension =     runSplitExtension $-    switchFileOrDirPath+    switchFileDir         (SplitExtension splitExtension)         (SplitExtension componentsSplitExtension)         (SplitExtension componentsSplitExtension)@@ -1594,10 +1503,10 @@         splitExtensionPC pcs  genericSplitExtensions ::-    (FileOrDirClass fd) => Path os ar fd -> (Path os ar fd, String)+    (Class.FileDir fd) => Path os ar fd -> (Path os ar fd, String) genericSplitExtensions =     runSplitExtension $-    switchFileOrDirPath+    switchFileDir         (SplitExtension splitExtensions)         (SplitExtension componentsSplitExtensions)         (SplitExtension componentsSplitExtensions)@@ -1609,10 +1518,10 @@         (error "genericSplitExtensions: empty path")         splitExtensionsPC pcs -genericTakeExtension :: (FileOrDirClass fd) => Path os ar fd -> String+genericTakeExtension :: (Class.FileDir fd) => Path os ar fd -> String genericTakeExtension = snd . genericSplitExtension -genericTakeExtensions :: (FileOrDirClass fd) => Path os ar fd -> String+genericTakeExtensions :: (Class.FileDir fd) => Path os ar fd -> String genericTakeExtensions = snd . genericSplitExtension  newtype@@ -1672,7 +1581,7 @@ splitExtensionPC :: PathComponent os -> (PathComponent os, String) splitExtensionPC (PathComponent s) =     mapFst PathComponent $-    maybe (s, "") (mapFst concat) $+    P.maybe (s, "") (mapFst concat) $     ((\p@(pcs,_) -> toMaybe (not (null pcs)) p) =<<) $ ListHT.viewR $     ListHT.segmentBefore isExtSeparator s @@ -1689,53 +1598,25 @@   -class System os where-    -- | The character that separates directories. In the case where more than-    --   one character is possible, 'pathSeparator' is the \'ideal\' one.-    ---    -- >> Posix.isPathSeparator Posix.pathSeparator-    pathSeparator :: Tagged os Char--    -- | The list of all possible separators.-    ---    -- >> Posix.pathSeparator `elem` Posix.pathSeparators-    pathSeparators :: Tagged os [Char]-    pathSeparators = (:[]) <$> pathSeparator--    -- | Rather than using @(== 'pathSeparator')@, use this. Test if something-    --   is a path separator.-    ---    -- >> Posix.isPathSeparator a == (a `elem` Posix.pathSeparators)-    isPathSeparator :: Tagged os (Char -> Bool)-    isPathSeparator = flip elem <$> pathSeparators--    splitAbsolute :: Tagged os (MS.State String String)--    canonicalize :: Tagged os (String -> String)--    splitDrive :: Tagged os (MS.State String String)-    genDrive :: Tagged os (Gen String)-- {- | Check internal integrity of the path data structure. -} isValid ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     Path os ar fd -> Bool isValid = untag isValidTagged  isValidTagged ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>     Tagged os (Path os ar fd -> Bool) isValidTagged =     fmap         (\isValidPC (Path ar pcs fd) ->-            absRelPlain isValidComponent True ar+            Class.withAbsRel isValidComponent True ar             &&             all isValidPC pcs             &&-            fileOrDirPlain (isValidPC . retagPC) True True fd)+            Class.withFileDir (isValidPC . retagPC) True True fd)         isValidPathComponent  isValidComponent :: String -> Bool@@ -1754,8 +1635,8 @@  testAll :: (System os) => os -> [(String, IO ())] testAll os =-    ("asPath_getPathString",-        quickCheck os prop_asPath_getPathString) :+    ("asPath_toString",+        quickCheck os prop_asPath_toString) :     ("mkPathFromComponents_pathComponents",         quickCheck os prop_mkPathFromComponents_pathComponents) :     ("combine_currentDir",@@ -1766,14 +1647,18 @@         quickCheck os prop_makeAbsoluteFromDir_startSame) :     ("split_combine",         quickCheck os prop_split_combine) :+    ("splitDir_combine",+        quickCheck os prop_splitDir_combine) :     ("takeFileName_end",         quickCheck os prop_takeFileName_end) :+    ("takeDirName_end",+        quickCheck os prop_takeDirName_end) :     ("split_combineExt",         quickCheck os prop_split_combineExt) :     []  quickCheck ::-    (QC.Testable prop, System os, FileOrDirClass fd, AbsOrRelClass ar) =>+    (QC.Testable prop, System os, Class.FileDir fd, Class.AbsRel ar) =>     os -> (Path os ar fd -> prop) -> IO () quickCheck _ = QC.quickCheck @@ -1798,11 +1683,12 @@                   ]  -qcAbsRel :: (System os, AbsOrRelClass ar) => Tagged os (Gen ar)+qcAbsRel :: (System os, Class.AbsRel ar) => Tagged os (Gen ar) qcAbsRel =     flip fmap genDrive $ \drive ->-        switchAbsOrRel (fmap absPC drive) (return Rel)-            (QC.oneof [fmap (AbsO . PathComponent) drive, return RelO])+        Class.switchAbsRel (fmap absPC drive) (return Part.Rel)+            (QC.oneof+                [fmap (Part.AbsO . PathComponent) drive, return Part.RelO])  qcGenPath ::     Tagged os (Gen ar) ->@@ -1810,24 +1696,25 @@     Gen (Path os ar fd) qcGenPath qcAR gen = gen $ untag qcAR -qcFilePath :: (System os, AbsOrRelClass ar) => Gen (FilePath os ar)+qcFilePath :: (System os, Class.AbsRel ar) => Gen (FilePath os ar) qcFilePath = qcGenPath qcAbsRel $ \qcAR -> do     ar <- qcAR     pcs <- QC.listOf qcDirComponent     pc <- qcFileComponent-    return $ Path ar pcs $ File pc+    return $ Path ar pcs $ Part.File pc -qcDirPath :: (System os, AbsOrRelClass ar) => fd -> Gen (Path os ar fd)+qcDirPath :: (System os, Class.AbsRel ar) => fd -> Gen (Path os ar fd) qcDirPath fd = qcGenPath qcAbsRel $ \qcAR -> do     ar <- qcAR     pcs <- QC.listOf qcDirComponent     return $ Path ar pcs fd  qcPath ::-    (System os, AbsOrRelClass ar, FileOrDirClass fd) => Gen (Path os ar fd)-qcPath = switchFileOrDirPath qcFilePath (qcDirPath Dir) (qcDirPath FileOrDir)+    (System os, Class.AbsRel ar, Class.FileDir fd) => Gen (Path os ar fd)+qcPath =+    switchFileDir qcFilePath (qcDirPath Part.Dir) (qcDirPath Part.FileDir)  instance-    (System os, AbsOrRelClass ar, FileOrDirClass fd) =>+    (System os, Class.AbsRel ar, Class.FileDir fd) =>         Arbitrary (Path os ar fd) where     arbitrary = qcPath
+ src/System/Path/Internal/Part.hs view
@@ -0,0 +1,112 @@+module System.Path.Internal.Part where++import qualified Control.Monad.Trans.State as MS+import Control.Applicative ((<$>))+import Control.DeepSeq (NFData(rnf))++import Data.Tagged (Tagged(Tagged))+import Data.Ord.HT (comparing)+import Data.Eq.HT (equating)++import Test.QuickCheck (Gen)+++newtype Abs = Abs GenComponent+data Rel = Rel+data AbsRel = AbsO GenComponent | RelO++absPC :: String -> Abs+absPC = Abs . PathComponent++emptyPC :: PathComponent os+emptyPC = PathComponent ""++newtype File = File GenComponent+data Dir = Dir+data FileDir = FileDir+++instance NFData Abs where+    rnf (Abs drive) = rnf drive++instance NFData Rel where+    rnf Rel = ()++instance NFData File where+    rnf (File pc) = rnf pc++instance NFData Dir where+    rnf Dir = ()++instance NFData FileDir where+    rnf FileDir = ()+++data Generic = Generic+++{- |+We cannot have a PathComponent without phantom types plus a Tagged wrapper,+because we need specialised Eq and Ord instances.+-}+type GenComponent = PathComponent Generic++newtype PathComponent os = PathComponent String++instance NFData (PathComponent os) where+    rnf (PathComponent pc) = rnf pc++instance (System os) => Eq (PathComponent os) where+    (==)  =  equating (applyComp canonicalize)++instance (System os) => Ord (PathComponent os) where+    compare  =  comparing (applyComp canonicalize)++applyComp :: Tagged os (String -> String) -> PathComponent os -> String+applyComp (Tagged canon) (PathComponent pc) = canon pc++retagPC :: GenComponent -> PathComponent os+retagPC (PathComponent pc) = PathComponent pc++untagPC :: PathComponent os -> GenComponent+untagPC (PathComponent pc) = PathComponent pc+++fileMap :: (String -> String) -> File -> File+fileMap f (File pc) = File $ pcMap f pc++pcMap :: (String -> String) -> PathComponent os -> PathComponent os+pcMap f (PathComponent s) = PathComponent $ f s++pcMapF ::+    (Functor f) =>+    (String -> f String) -> PathComponent os -> f (PathComponent os)+pcMapF f (PathComponent s) = PathComponent <$> f s+++class System os where+    -- | The character that separates directories. In the case where more than+    --   one character is possible, 'pathSeparator' is the \'ideal\' one.+    --+    -- >> Posix.isPathSeparator Posix.pathSeparator+    pathSeparator :: Tagged os Char++    -- | The list of all possible separators.+    --+    -- >> Posix.pathSeparator `elem` Posix.pathSeparators+    pathSeparators :: Tagged os [Char]+    pathSeparators = (:[]) <$> pathSeparator++    -- | Rather than using @(== 'pathSeparator')@, use this. Test if something+    --   is a path separator.+    --+    -- >> Posix.isPathSeparator a == (a `elem` Posix.pathSeparators)+    isPathSeparator :: Tagged os (Char -> Bool)+    isPathSeparator = flip elem <$> pathSeparators++    splitAbsolute :: Tagged os (MS.State String String)++    canonicalize :: Tagged os (String -> String)++    splitDrive :: Tagged os (MS.State String String)+    genDrive :: Tagged os (Gen String)
+ src/System/Path/Internal/PartClass.hs view
@@ -0,0 +1,144 @@+module System.Path.Internal.PartClass where++import qualified System.Path.Internal.Part as Part+import System.Path.Internal.Part+        (PathComponent(PathComponent), GenComponent, System(..), retagPC)++import Data.Monoid (Endo(Endo), appEndo)+import Data.Ord.HT (comparing)+import Data.Eq.HT (equating)++++------------------------------------------------------------------------+-- Type classes and machinery for switching on Part.Abs/Part.Rel and Part.File/Part.Dir++-- | This class provides a way to prevent other modules+--   from making further 'AbsOrRel' or 'FileOrDir'+--   instances+class Private p+instance Private Part.Abs+instance Private Part.Rel+instance Private Part.AbsRel+instance Private Part.File+instance Private Part.Dir+instance Private Part.FileDir+++-- | This class allows selective behaviour for absolute and+--   relative paths and is mostly for internal use.+class Private ar => AbsRel ar where+    {- |+    See <https://wiki.haskell.org/Closed_world_instances>+    for the used technique.+    -}+    switchAbsRel :: f Part.Abs -> f Part.Rel -> f Part.AbsRel -> f ar++instance AbsRel Part.Abs    where switchAbsRel f _ _ = f+instance AbsRel Part.Rel    where switchAbsRel _ f _ = f+instance AbsRel Part.AbsRel where switchAbsRel _ _ f = f++class AbsRel ar => AbsOrRel ar where+    switchAbsOrRel :: f Part.Abs -> f Part.Rel -> f ar++instance AbsOrRel Part.Abs where switchAbsOrRel f _ = f+instance AbsOrRel Part.Rel where switchAbsOrRel _ f = f+++class AbsOrRel ar => Abs ar where switchAbs :: f Part.Abs -> f ar+instance Abs Part.Abs where switchAbs = id++class AbsOrRel ar => Rel ar where switchRel :: f Part.Rel -> f ar+instance Rel Part.Rel where switchRel = id++relVar :: Rel ar => ar+relVar = unwrapAbsRel $ switchRel $ WrapAbsRel Part.Rel+++-- | This class allows selective behaviour for file and+--   directory paths and is mostly for internal use.+class Private fd => FileDir fd where+    switchFileDir :: f Part.File -> f Part.Dir -> f Part.FileDir -> f fd++instance FileDir Part.File    where switchFileDir f _ _ = f+instance FileDir Part.Dir     where switchFileDir _ f _ = f+instance FileDir Part.FileDir where switchFileDir _ _ f = f++class FileDir fd => FileOrDir fd where+    switchFileOrDir :: f Part.File -> f Part.Dir -> f fd++instance FileOrDir Part.File where switchFileOrDir f _ = f+instance FileOrDir Part.Dir  where switchFileOrDir _ f = f+++class FileOrDir fd => File fd where switchFile :: f Part.File -> f fd+instance File Part.File where switchFile = id++class FileOrDir fd => Dir fd where switchDir :: f Part.Dir -> f fd+instance Dir Part.Dir where switchDir = id++dirVar :: Dir fd => fd+dirVar = unwrapFileDir $ switchDir $ WrapFileDir Part.Dir+++newtype FuncArg b a = FuncArg {runFuncArg :: a -> b}++withAbsRel :: (AbsRel ar) => (String -> a) -> a -> ar -> a+withAbsRel fAbs fRel =+    runFuncArg $+    switchAbsRel+        (FuncArg $ \(Part.Abs (PathComponent drive)) -> fAbs drive)+        (FuncArg $ \Part.Rel -> fRel)+        (FuncArg $ \ar ->+            case ar of+                Part.AbsO (PathComponent drive) -> fAbs drive+                Part.RelO -> fRel)++withFileDir :: (FileDir fd) => (GenComponent -> a) -> a -> a -> fd -> a+withFileDir fFile fDir fFileOrDir =+    runFuncArg $+    switchFileDir (FuncArg $ \(Part.File pc) -> fFile pc)+        (FuncArg $ \Part.Dir -> fDir) (FuncArg $ \Part.FileDir -> fFileOrDir)++withFileOrDir :: (FileOrDir fd) => (GenComponent -> a) -> a -> fd -> a+withFileOrDir fFile fDir =+    runFuncArg $+    switchFileOrDir+        (FuncArg $ \(Part.File pc) -> fFile pc)+        (FuncArg $ \Part.Dir -> fDir)++++isAbsolute :: (AbsRel ar) => ar -> Bool+isAbsolute = withAbsRel (const True) False++fdMap :: (FileDir fd) => (String -> String) -> fd -> fd+fdMap f = appEndo $ switchFileDir (Endo $ Part.fileMap f) (Endo id) (Endo id)+++newtype WrapAbsRel os ar = WrapAbsRel {unwrapAbsRel :: ar}++inspectAbsRel ::+    (AbsRel ar) => WrapAbsRel os ar -> Either (PathComponent os) ()+inspectAbsRel =+    withAbsRel (Left . PathComponent) (Right ()) . unwrapAbsRel++instance (System os, AbsRel ar) => Eq (WrapAbsRel os ar) where+    (==) = equating inspectAbsRel++instance (System os, AbsRel ar) => Ord (WrapAbsRel os ar) where+    compare = comparing inspectAbsRel+++newtype WrapFileDir os fd = WrapFileDir {unwrapFileDir :: fd}++inspectFileDir ::+    (FileDir ar) => WrapFileDir os ar -> Either (PathComponent os) ()+inspectFileDir =+    withFileDir (Left . retagPC) (Right ()) (Right ()) . unwrapFileDir++instance (System os, FileDir fd) => Eq (WrapFileDir os fd) where+    (==) = equating inspectFileDir++instance (System os, FileDir fd) => Ord (WrapFileDir os fd) where+    compare = comparing inspectFileDir
+ src/System/Path/Part.hs view
@@ -0,0 +1,11 @@+module System.Path.Part (+    -- * Possible types for Path type parameters+    Abs,+    Rel,+    AbsRel,+    File,+    Dir,+    FileDir,+    ) where++import System.Path.Internal.Part
+ src/System/Path/PartClass.hs view
@@ -0,0 +1,6 @@+module System.Path.PartClass (+    AbsRel(..), AbsOrRel(..),+    FileDir(..), FileOrDir(..),+    ) where++import System.Path.Internal.PartClass
src/System/Path/Posix.hs view
@@ -9,14 +9,17 @@ module System.Path.Posix (     Path,     AbsFile, RelFile, AbsDir, RelDir,+    Abs, Rel, File, Dir,+    AbsRelFile, AbsRelDir, AbsFileDir, RelFileDir,+    AbsRel, FileDir, AbsRelFileDir,     AbsPath, RelPath, FilePath, DirPath,-    AbsOrRelFile, AbsOrRelDir, AbsFileOrDir, RelFileOrDir,-    AbsOrRelPath, FileOrDirPath, AbsOrRelFileOrDir,+    AbsRelPath, FileDirPath,     asPath,     asRelFile, asRelDir, asAbsFile, asAbsDir,     asRelPath, asAbsPath, asFilePath, asDirPath,-    path, maybePath,+    path, maybe, maybePath, parse, parsePath,     relFile, relDir, absFile, absDir,+    abs, rel, absRel, file, dir, fileDir,     relPath, absPath, filePath, dirPath,     rootDir, currentDir, emptyFile,     toString,@@ -30,16 +33,12 @@     ) where  import qualified System.Path.RegularExpression as RegEx+import qualified System.Path.Internal.PartClass as Class import qualified System.Path.Internal as Core-import System.Path.Internal (-    Abs, Rel, AbsOrRel, File, Dir, FileOrDir,-    AbsRelClass, FileDirClass,-    AbsOrRelClass, FileOrDirClass,-    )  import Data.Tagged (Tagged(Tagged), untag) -import Prelude hiding (FilePath)+import Prelude hiding (FilePath, maybe, abs)   data Posix = Posix@@ -47,27 +46,36 @@ _osDummy :: Posix _osDummy = Posix -type Path = Core.Path Posix+type System = Posix -type AbsFile = Path Abs File-type RelFile = Path Rel File-type AbsDir  = Path Abs Dir-type RelDir  = Path Rel Dir-type AbsOrRelFile = Path AbsOrRel File-type AbsOrRelDir  = Path AbsOrRel Dir-type AbsFileOrDir = Path Abs FileOrDir-type RelFileOrDir = Path Rel FileOrDir-type AbsOrRelFileOrDir = Path AbsOrRel FileOrDir+type Path = Core.Path System -type AbsPath  fd = Path Abs fd-type RelPath  fd = Path Rel fd-type FilePath ar = Path ar File-type DirPath  ar = Path ar Dir-type AbsOrRelPath  fd = Path AbsOrRel fd-type FileOrDirPath ar = Path ar FileOrDir+type AbsFile = Core.AbsFile System+type RelFile = Core.RelFile System+type AbsDir  = Core.AbsDir  System+type RelDir  = Core.RelDir  System+type AbsRelFile = Core.AbsRelFile System+type AbsRelDir  = Core.AbsRelDir  System+type AbsFileDir = Core.AbsFileDir System+type RelFileDir = Core.RelFileDir System+type AbsRelFileDir = Core.AbsRelFileDir System +type Abs  fd = Core.Abs  System fd+type Rel  fd = Core.Rel  System fd+type File ar = Core.File System ar+type Dir  ar = Core.Dir  System ar+type AbsRel  fd = Core.AbsRel  System fd+type FileDir ar = Core.FileDir System ar++type AbsPath  fd = Core.AbsPath  System fd+type RelPath  fd = Core.RelPath  System fd+type FilePath ar = Core.FilePath System ar+type DirPath  ar = Core.DirPath  System ar+type AbsRelPath  fd = Core.AbsRelPath  System fd+type FileDirPath ar = Core.FileDirPath System ar+ {-# DEPRECATED asPath "Use 'maybePath', 'parsePath' or 'path' instead." #-}-asPath :: (AbsRelClass ar, FileDirClass fd) => String -> Path ar fd+asPath :: (Class.AbsOrRel ar, Class.FileOrDir fd) => String -> Path ar fd asPath = Core.asPath  {-# DEPRECATED asRelFile "Use 'relFile' instead." #-}@@ -87,28 +95,37 @@ asAbsDir = Core.asAbsDir  {-# DEPRECATED asRelPath "Use 'relPath' instead." #-}-asRelPath :: (FileDirClass fd) => String -> RelPath fd+asRelPath :: (Class.FileOrDir fd) => String -> RelPath fd asRelPath = Core.asRelPath  {-# DEPRECATED asAbsPath "Use 'absPath' instead." #-}-asAbsPath :: (FileDirClass fd) => String -> AbsPath fd+asAbsPath :: (Class.FileOrDir fd) => String -> AbsPath fd asAbsPath = Core.asAbsPath  {-# DEPRECATED asFilePath "Use 'filePath' instead." #-}-asFilePath :: (AbsRelClass ar) => String -> FilePath ar+asFilePath :: (Class.AbsOrRel ar) => String -> FilePath ar asFilePath = Core.asFilePath  {-# DEPRECATED asDirPath "Use 'dirPath' instead." #-}-asDirPath :: (AbsRelClass ar) => String -> DirPath ar+asDirPath :: (Class.AbsOrRel ar) => String -> DirPath ar asDirPath = Core.asDirPath  -maybePath ::-    (AbsOrRelClass ar, FileOrDirClass fd) => String -> Maybe (Path ar fd)-maybePath = Core.maybePath+{-# DEPRECATED maybePath "Use Path.maybe instead." #-}+{-# DEPRECATED parsePath "Use Path.parse instead." #-} +maybe, maybePath ::+    (Class.AbsRel ar, Class.FileDir fd) => String -> Maybe (Path ar fd)+maybe = Core.maybe+maybePath = Core.maybe -path :: (AbsOrRelClass ar, FileOrDirClass fd) => String -> Path ar fd+parse, parsePath ::+    (Class.AbsRel ar, Class.FileDir fd) => String -> Either String (Path ar fd)+parse = Core.parse+parsePath = Core.parse+++path :: (Class.AbsRel ar, Class.FileDir fd) => String -> Path ar fd path = Core.path  relFile :: String -> RelFile@@ -123,16 +140,36 @@ absDir :: String -> AbsDir absDir = Core.absDir -relPath :: (FileOrDirClass fd) => String -> RelPath fd++rel :: (Class.FileDir fd) => String -> Rel fd+rel = Core.rel++abs :: (Class.FileDir fd) => String -> Abs fd+abs = Core.abs++absRel :: (Class.FileDir fd) => String -> AbsRel fd+absRel = Core.absRel++file :: (Class.AbsRel ar) => String -> File ar+file = Core.file++dir :: (Class.AbsRel ar) => String -> Dir ar+dir = Core.dir++fileDir :: (Class.AbsRel ar) => String -> FileDir ar+fileDir = Core.fileDir+++relPath :: (Class.FileDir fd) => String -> RelPath fd relPath = Core.relPath -absPath :: (FileOrDirClass fd) => String -> AbsPath fd+absPath :: (Class.FileDir fd) => String -> AbsPath fd absPath = Core.absPath -filePath :: (AbsOrRelClass ar) => String -> FilePath ar+filePath :: (Class.AbsRel ar) => String -> FilePath ar filePath = Core.filePath -dirPath :: (AbsOrRelClass ar) => String -> DirPath ar+dirPath :: (Class.AbsRel ar) => String -> DirPath ar dirPath = Core.dirPath  @@ -146,7 +183,7 @@ emptyFile = Core.emptyFile  -toString :: (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> String+toString :: (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> String toString = Core.toString  @@ -157,9 +194,13 @@    splitDrive = Tagged $ return ""    genDrive = Tagged $ return "" -withOS :: Tagged Posix a -> a+withOS :: Tagged System a -> a withOS = untag ++{-# DEPRECATED equalFilePath "Use System.FilePath.equalFilePath instead." #-}+{-# DEPRECATED isAbsoluteString "Use System.FilePath.isAbsolute instead." #-}+{-# DEPRECATED isRelativeString "Use System.FilePath.isRelative instead." #-}  equalFilePath :: String -> String -> Bool equalFilePath = withOS Core.equalFilePath
src/System/Path/Windows.hs view
@@ -9,14 +9,17 @@ module System.Path.Windows (     Path,     AbsFile, RelFile, AbsDir, RelDir,+    Abs, Rel, File, Dir,+    AbsRelFile, AbsRelDir, AbsFileDir, RelFileDir,+    AbsRel, FileDir, AbsRelFileDir,     AbsPath, RelPath, FilePath, DirPath,-    AbsOrRelFile, AbsOrRelDir, AbsFileOrDir, RelFileOrDir,-    AbsOrRelPath, FileOrDirPath, AbsOrRelFileOrDir,+    AbsRelPath, FileDirPath,     asPath,     asRelFile, asRelDir, asAbsFile, asAbsDir,     asRelPath, asAbsPath, asFilePath, asDirPath,-    path, maybePath,+    path, maybe, maybePath, parse, parsePath,     relFile, relDir, absFile, absDir,+    abs, rel, absRel, file, dir, fileDir,     relPath, absPath, filePath, dirPath,     rootDir, currentDir, emptyFile,     toString,@@ -30,13 +33,9 @@     ) where  import qualified System.Path.RegularExpression as RegEx+import qualified System.Path.Internal.PartClass as Class import qualified System.Path.Internal as Core import System.Path.RegularExpression ((-|-))-import System.Path.Internal (-    Abs, Rel, AbsOrRel, File, Dir, FileOrDir,-    AbsRelClass, FileDirClass,-    AbsOrRelClass, FileOrDirClass,-    )  import Data.Tagged (Tagged(Tagged), untag) import Data.Char (isAlpha, toLower)@@ -44,7 +43,7 @@  import qualified Test.QuickCheck as QC -import Prelude hiding (FilePath)+import Prelude hiding (FilePath, maybe, abs)   data Windows = Windows@@ -52,27 +51,36 @@ _osDummy :: Windows _osDummy = Windows -type Path = Core.Path Windows+type System = Windows -type AbsFile = Path Abs File-type RelFile = Path Rel File-type AbsDir  = Path Abs Dir-type RelDir  = Path Rel Dir-type AbsOrRelFile = Path AbsOrRel File-type AbsOrRelDir  = Path AbsOrRel Dir-type AbsFileOrDir = Path Abs FileOrDir-type RelFileOrDir = Path Rel FileOrDir-type AbsOrRelFileOrDir = Path AbsOrRel FileOrDir+type Path = Core.Path System -type AbsPath  fd = Path Abs fd-type RelPath  fd = Path Rel fd-type FilePath ar = Path ar File-type DirPath  ar = Path ar Dir-type AbsOrRelPath  fd = Path AbsOrRel fd-type FileOrDirPath ar = Path ar FileOrDir+type AbsFile = Core.AbsFile System+type RelFile = Core.RelFile System+type AbsDir  = Core.AbsDir  System+type RelDir  = Core.RelDir  System+type AbsRelFile = Core.AbsRelFile System+type AbsRelDir  = Core.AbsRelDir  System+type AbsFileDir = Core.AbsFileDir System+type RelFileDir = Core.RelFileDir System+type AbsRelFileDir = Core.AbsRelFileDir System +type Abs  fd = Core.Abs  System fd+type Rel  fd = Core.Rel  System fd+type File ar = Core.File System ar+type Dir  ar = Core.Dir  System ar+type AbsRel  fd = Core.AbsRel  System fd+type FileDir ar = Core.FileDir System ar++type AbsPath  fd = Core.AbsPath  System fd+type RelPath  fd = Core.RelPath  System fd+type FilePath ar = Core.FilePath System ar+type DirPath  ar = Core.DirPath  System ar+type AbsRelPath  fd = Core.AbsRelPath  System fd+type FileDirPath ar = Core.FileDirPath System ar+ {-# DEPRECATED asPath "Use 'maybePath', 'parsePath' or 'path' instead." #-}-asPath :: (AbsRelClass ar, FileDirClass fd) => String -> Path ar fd+asPath :: (Class.AbsOrRel ar, Class.FileOrDir fd) => String -> Path ar fd asPath = Core.asPath  {-# DEPRECATED asRelFile "Use 'relFile' instead." #-}@@ -92,28 +100,37 @@ asAbsDir = Core.asAbsDir  {-# DEPRECATED asRelPath "Use 'relPath' instead." #-}-asRelPath :: (FileDirClass fd) => String -> RelPath fd+asRelPath :: (Class.FileOrDir fd) => String -> RelPath fd asRelPath = Core.asRelPath  {-# DEPRECATED asAbsPath "Use 'absPath' instead." #-}-asAbsPath :: (FileDirClass fd) => String -> AbsPath fd+asAbsPath :: (Class.FileOrDir fd) => String -> AbsPath fd asAbsPath = Core.asAbsPath  {-# DEPRECATED asFilePath "Use 'filePath' instead." #-}-asFilePath :: (AbsRelClass ar) => String -> FilePath ar+asFilePath :: (Class.AbsOrRel ar) => String -> FilePath ar asFilePath = Core.asFilePath  {-# DEPRECATED asDirPath "Use 'dirPath' instead." #-}-asDirPath :: (AbsRelClass ar) => String -> DirPath ar+asDirPath :: (Class.AbsOrRel ar) => String -> DirPath ar asDirPath = Core.asDirPath  -maybePath ::-    (AbsOrRelClass ar, FileOrDirClass fd) => String -> Maybe (Path ar fd)-maybePath = Core.maybePath+{-# DEPRECATED maybePath "Use Path.maybe instead." #-}+{-# DEPRECATED parsePath "Use Path.parse instead." #-} +maybe, maybePath ::+    (Class.AbsRel ar, Class.FileDir fd) => String -> Maybe (Path ar fd)+maybe = Core.maybe+maybePath = Core.maybe -path :: (AbsOrRelClass ar, FileOrDirClass fd) => String -> Path ar fd+parse, parsePath ::+    (Class.AbsRel ar, Class.FileDir fd) => String -> Either String (Path ar fd)+parse = Core.parse+parsePath = Core.parse+++path :: (Class.AbsRel ar, Class.FileDir fd) => String -> Path ar fd path = Core.path  relFile :: String -> RelFile@@ -128,16 +145,36 @@ absDir :: String -> AbsDir absDir = Core.absDir -relPath :: (FileOrDirClass fd) => String -> RelPath fd++rel :: (Class.FileDir fd) => String -> Rel fd+rel = Core.rel++abs :: (Class.FileDir fd) => String -> Abs fd+abs = Core.abs++absRel :: (Class.FileDir fd) => String -> AbsRel fd+absRel = Core.absRel++file :: (Class.AbsRel ar) => String -> File ar+file = Core.file++dir :: (Class.AbsRel ar) => String -> Dir ar+dir = Core.dir++fileDir :: (Class.AbsRel ar) => String -> FileDir ar+fileDir = Core.fileDir+++relPath :: (Class.FileDir fd) => String -> RelPath fd relPath = Core.relPath -absPath :: (FileOrDirClass fd) => String -> AbsPath fd+absPath :: (Class.FileDir fd) => String -> AbsPath fd absPath = Core.absPath -filePath :: (AbsOrRelClass ar) => String -> FilePath ar+filePath :: (Class.AbsRel ar) => String -> FilePath ar filePath = Core.filePath -dirPath :: (AbsOrRelClass ar) => String -> DirPath ar+dirPath :: (Class.AbsRel ar) => String -> DirPath ar dirPath = Core.dirPath  @@ -151,7 +188,7 @@ emptyFile = Core.emptyFile  -toString :: (AbsOrRelClass ar, FileOrDirClass fd) => Path ar fd -> String+toString :: (Class.AbsRel ar, Class.FileDir fd) => Path ar fd -> String toString = Core.toString  @@ -168,8 +205,13 @@ driveRegEx :: RegEx.Parser Char driveRegEx = RegEx.single isAlpha <> RegEx.single (':'==) -withOS :: Tagged Windows a -> a+withOS :: Tagged System a -> a withOS = untag+++{-# DEPRECATED equalFilePath "Use System.FilePath.equalFilePath instead." #-}+{-# DEPRECATED isAbsoluteString "Use System.FilePath.isAbsolute instead." #-}+{-# DEPRECATED isRelativeString "Use System.FilePath.isRelative instead." #-}  equalFilePath :: String -> String -> Bool equalFilePath = withOS Core.equalFilePath
test/TestResult.hs view
@@ -2,6 +2,7 @@ {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} module TestResult (results) where +import qualified System.Path.PartClass as Class import qualified System.Path.Generic as Path import qualified System.Path.Posix as Posix import qualified System.Path.Windows as Windows@@ -9,556 +10,567 @@ import Data.Char (toLower)  -results ::-  (Path.AbsRelClass ar) => Char -> Posix.FilePath ar -> [(String, Bool)]+results :: (Class.AbsRel ar) => Char -> Posix.FilePath ar -> [(String, Bool)] results a x =-  {-# LINE 353 "src/System/Path/Internal.hs" #-}+  {-# LINE 258 "src/System/Path/Internal.hs" #-}   ("Path.pathMap (map toLower) (absDir \"/tmp/Reports/SpreadSheets\") == Posix.absDir \"/tmp/reports/spreadsheets\"",       Path.pathMap (map toLower) (absDir "/tmp/Reports/SpreadSheets") == Posix.absDir "/tmp/reports/spreadsheets") :-  {-# LINE 490 "src/System/Path/Internal.hs" #-}+  {-# LINE 331 "src/System/Path/Internal.hs" #-}   ("show (Posix.rootDir </> relDir \"bla\" </> relFile \"blub\") == \"rootDir </> relPath \\\"bla\\\" </> relPath \\\"blub\\\"\"",       show (Posix.rootDir </> relDir "bla" </> relFile "blub") == "rootDir </> relPath \"bla\" </> relPath \"blub\"") :-  {-# LINE 491 "src/System/Path/Internal.hs" #-}+  {-# LINE 332 "src/System/Path/Internal.hs" #-}   ("show (Just (Posix.rootDir </> relDir \"bla\" </> relFile \"blub\")) == \"Just (rootDir </> relPath \\\"bla\\\" </> relPath \\\"blub\\\")\"",       show (Just (Posix.rootDir </> relDir "bla" </> relFile "blub")) == "Just (rootDir </> relPath \"bla\" </> relPath \"blub\")") :-  {-# LINE 492 "src/System/Path/Internal.hs" #-}+  {-# LINE 333 "src/System/Path/Internal.hs" #-}   ("show (Posix.currentDir </> relDir \"bla\" </> relFile \"blub\") == \"currentDir </> relPath \\\"bla\\\" </> relPath \\\"blub\\\"\"",       show (Posix.currentDir </> relDir "bla" </> relFile "blub") == "currentDir </> relPath \"bla\" </> relPath \"blub\"") :-  {-# LINE 493 "src/System/Path/Internal.hs" #-}+  {-# LINE 334 "src/System/Path/Internal.hs" #-}   ("show (Just (Posix.currentDir </> relDir \"bla\" </> relFile \"blub\")) == \"Just (currentDir </> relPath \\\"bla\\\" </> relPath \\\"blub\\\")\"",       show (Just (Posix.currentDir </> relDir "bla" </> relFile "blub")) == "Just (currentDir </> relPath \"bla\" </> relPath \"blub\")") :-  {-# LINE 494 "src/System/Path/Internal.hs" #-}+  {-# LINE 335 "src/System/Path/Internal.hs" #-}   ("show (Windows.absDir \"c:\" </> relDir \"bla\" </> relFile \"blub\") == \"absDir \\\"c:\\\" </> relPath \\\"bla\\\" </> relPath \\\"blub\\\"\"",       show (Windows.absDir "c:" </> relDir "bla" </> relFile "blub") == "absDir \"c:\" </> relPath \"bla\" </> relPath \"blub\"") :-  {-# LINE 495 "src/System/Path/Internal.hs" #-}+  {-# LINE 336 "src/System/Path/Internal.hs" #-}   ("show (Just (Windows.absDir \"c:\\\\\" </> relDir \"bla\" </> relFile \"blub\")) == \"Just (absDir \\\"c:\\\\\\\\\\\" </> relPath \\\"bla\\\" </> relPath \\\"blub\\\")\"",       show (Just (Windows.absDir "c:\\" </> relDir "bla" </> relFile "blub")) == "Just (absDir \"c:\\\\\" </> relPath \"bla\" </> relPath \"blub\")") :-  {-# LINE 527 "src/System/Path/Internal.hs" #-}+  {-# LINE 368 "src/System/Path/Internal.hs" #-}   ("read \"rootDir\" == Posix.rootDir",       read "rootDir" == Posix.rootDir) :-  {-# LINE 528 "src/System/Path/Internal.hs" #-}+  {-# LINE 369 "src/System/Path/Internal.hs" #-}   ("read \"rootDir\" == Windows.rootDir",       read "rootDir" == Windows.rootDir) :-  {-# LINE 529 "src/System/Path/Internal.hs" #-}+  {-# LINE 370 "src/System/Path/Internal.hs" #-}   ("read \"currentDir\" == Posix.currentDir",       read "currentDir" == Posix.currentDir) :-  {-# LINE 530 "src/System/Path/Internal.hs" #-}+  {-# LINE 371 "src/System/Path/Internal.hs" #-}   ("read \"currentDir\" == Windows.currentDir",       read "currentDir" == Windows.currentDir) :-  {-# LINE 531 "src/System/Path/Internal.hs" #-}+  {-# LINE 372 "src/System/Path/Internal.hs" #-}   ("let path = Posix.rootDir </> relDir \"bla\" </> relFile \"blub\" in read (show path) == path",       let path = Posix.rootDir </> relDir "bla" </> relFile "blub" in read (show path) == path) :-  {-# LINE 532 "src/System/Path/Internal.hs" #-}+  {-# LINE 373 "src/System/Path/Internal.hs" #-}   ("let path = Just (Posix.rootDir </> relDir \"bla\" </> relFile \"blub\") in read (show path) == path",       let path = Just (Posix.rootDir </> relDir "bla" </> relFile "blub") in read (show path) == path) :-  {-# LINE 533 "src/System/Path/Internal.hs" #-}+  {-# LINE 374 "src/System/Path/Internal.hs" #-}   ("let path = Posix.currentDir </> relDir \"bla\" </> relFile \"blub\" in read (show path) == path",       let path = Posix.currentDir </> relDir "bla" </> relFile "blub" in read (show path) == path) :-  {-# LINE 534 "src/System/Path/Internal.hs" #-}+  {-# LINE 375 "src/System/Path/Internal.hs" #-}   ("let path = Just (Posix.currentDir </> relDir \"bla\" </> relFile \"blub\") in read (show path) == path",       let path = Just (Posix.currentDir </> relDir "bla" </> relFile "blub") in read (show path) == path) :-  {-# LINE 535 "src/System/Path/Internal.hs" #-}+  {-# LINE 376 "src/System/Path/Internal.hs" #-}   ("let path = Windows.rootDir </> relDir \"bla\" </> relFile \"blub\" in read (show path) == path",       let path = Windows.rootDir </> relDir "bla" </> relFile "blub" in read (show path) == path) :-  {-# LINE 536 "src/System/Path/Internal.hs" #-}+  {-# LINE 377 "src/System/Path/Internal.hs" #-}   ("let path = Just (Windows.rootDir </> relDir \"bla\" </> relFile \"blub\") in read (show path) == path",       let path = Just (Windows.rootDir </> relDir "bla" </> relFile "blub") in read (show path) == path) :-  {-# LINE 537 "src/System/Path/Internal.hs" #-}+  {-# LINE 378 "src/System/Path/Internal.hs" #-}   ("let path = Windows.absDir \"c:\" </> relDir \"bla\" </> relFile \"blub\" in read (show path) == path",       let path = Windows.absDir "c:" </> relDir "bla" </> relFile "blub" in read (show path) == path) :-  {-# LINE 632 "src/System/Path/Internal.hs" #-}+  {-# LINE 475 "src/System/Path/Internal.hs" #-}   ("Posix.toString Path.rootDir == \"/\"",       Posix.toString Path.rootDir == "/") :-  {-# LINE 633 "src/System/Path/Internal.hs" #-}+  {-# LINE 476 "src/System/Path/Internal.hs" #-}   ("Windows.toString Path.rootDir == \"\\\\\"",       Windows.toString Path.rootDir == "\\") :-  {-# LINE 643 "src/System/Path/Internal.hs" #-}+  {-# LINE 486 "src/System/Path/Internal.hs" #-}   ("Posix.toString Path.currentDir == \".\"",       Posix.toString Path.currentDir == ".") :-  {-# LINE 644 "src/System/Path/Internal.hs" #-}+  {-# LINE 487 "src/System/Path/Internal.hs" #-}   ("Windows.toString Path.currentDir == \".\"",       Windows.toString Path.currentDir == ".") :-  {-# LINE 683 "src/System/Path/Internal.hs" #-}+  {-# LINE 529 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/\" :: Maybe Posix.AbsDir) == Just \"/\"",       fmap Posix.toString (Posix.maybePath "/" :: Maybe Posix.AbsDir) == Just "/") :-  {-# LINE 684 "src/System/Path/Internal.hs" #-}+  {-# LINE 530 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/\" :: Maybe Posix.AbsFile) == Nothing",       fmap Posix.toString (Posix.maybePath "/" :: Maybe Posix.AbsFile) == Nothing) :-  {-# LINE 685 "src/System/Path/Internal.hs" #-}+  {-# LINE 531 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/\" :: Maybe Posix.RelDir) == Nothing",       fmap Posix.toString (Posix.maybePath "/" :: Maybe Posix.RelDir) == Nothing) :-  {-# LINE 686 "src/System/Path/Internal.hs" #-}+  {-# LINE 532 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/\" :: Maybe Posix.RelFile) == Nothing",       fmap Posix.toString (Posix.maybePath "/" :: Maybe Posix.RelFile) == Nothing) :-  {-# LINE 687 "src/System/Path/Internal.hs" #-}+  {-# LINE 533 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.AbsDir) == Just \"/tmp\"",       fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsDir) == Just "/tmp") :-  {-# LINE 688 "src/System/Path/Internal.hs" #-}+  {-# LINE 534 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.AbsFile) == Just \"/tmp\"",       fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsFile) == Just "/tmp") :-  {-# LINE 689 "src/System/Path/Internal.hs" #-}+  {-# LINE 535 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.RelDir) == Nothing",       fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.RelDir) == Nothing) :-  {-# LINE 690 "src/System/Path/Internal.hs" #-}+  {-# LINE 536 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.RelFile) == Nothing",       fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.RelFile) == Nothing) :-  {-# LINE 691 "src/System/Path/Internal.hs" #-}+  {-# LINE 537 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.AbsDir) == Just \"/tmp\"",       fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsDir) == Just "/tmp") :-  {-# LINE 692 "src/System/Path/Internal.hs" #-}+  {-# LINE 538 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.AbsFile) == Nothing",       fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsFile) == Nothing) :-  {-# LINE 693 "src/System/Path/Internal.hs" #-}+  {-# LINE 539 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.RelDir) == Nothing",       fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.RelDir) == Nothing) :-  {-# LINE 694 "src/System/Path/Internal.hs" #-}+  {-# LINE 540 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.RelFile) == Nothing",       fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.RelFile) == Nothing) :-  {-# LINE 695 "src/System/Path/Internal.hs" #-}-  ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.AbsOrRelFileOrDir) == Just \"/tmp\"",-      fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsOrRelFileOrDir) == Just "/tmp") :-  {-# LINE 696 "src/System/Path/Internal.hs" #-}-  ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.AbsOrRelFileOrDir) == Just \"/tmp\"",-      fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsOrRelFileOrDir) == Just "/tmp") :-  {-# LINE 697 "src/System/Path/Internal.hs" #-}+  {-# LINE 541 "src/System/Path/Internal.hs" #-}+  ("fmap Posix.toString (Posix.maybePath \"/tmp\" :: Maybe Posix.AbsRelFileDir) == Just \"/tmp\"",+      fmap Posix.toString (Posix.maybePath "/tmp" :: Maybe Posix.AbsRelFileDir) == Just "/tmp") :+  {-# LINE 542 "src/System/Path/Internal.hs" #-}+  ("fmap Posix.toString (Posix.maybePath \"/tmp/\" :: Maybe Posix.AbsRelFileDir) == Just \"/tmp\"",+      fmap Posix.toString (Posix.maybePath "/tmp/" :: Maybe Posix.AbsRelFileDir) == Just "/tmp") :+  {-# LINE 543 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"file.txt\" :: Maybe Posix.RelFile) == Just \"file.txt\"",       fmap Posix.toString (Posix.maybePath "file.txt" :: Maybe Posix.RelFile) == Just "file.txt") :-  {-# LINE 698 "src/System/Path/Internal.hs" #-}+  {-# LINE 544 "src/System/Path/Internal.hs" #-}   ("fmap Posix.toString (Posix.maybePath \"file.txt\" :: Maybe Posix.AbsFile) == Nothing",       fmap Posix.toString (Posix.maybePath "file.txt" :: Maybe Posix.AbsFile) == Nothing) :-  {-# LINE 699 "src/System/Path/Internal.hs" #-}+  {-# LINE 545 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"\\\\tmp\" :: Maybe Windows.AbsDir) == Just \"\\\\tmp\"",       fmap Windows.toString (Windows.maybePath "\\tmp" :: Maybe Windows.AbsDir) == Just "\\tmp") :-  {-# LINE 700 "src/System/Path/Internal.hs" #-}+  {-# LINE 546 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:\\\\tmp\" :: Maybe Windows.AbsDir) == Just \"a:\\\\tmp\"",       fmap Windows.toString (Windows.maybePath "a:\\tmp" :: Maybe Windows.AbsDir) == Just "a:\\tmp") :-  {-# LINE 701 "src/System/Path/Internal.hs" #-}+  {-# LINE 547 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:tmp\" :: Maybe Windows.AbsDir) == Just \"a:tmp\"",       fmap Windows.toString (Windows.maybePath "a:tmp" :: Maybe Windows.AbsDir) == Just "a:tmp") :-  {-# LINE 702 "src/System/Path/Internal.hs" #-}+  {-# LINE 548 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:\\\\\" :: Maybe Windows.AbsDir) == Just \"a:\\\\\"",       fmap Windows.toString (Windows.maybePath "a:\\" :: Maybe Windows.AbsDir) == Just "a:\\") :-  {-# LINE 703 "src/System/Path/Internal.hs" #-}+  {-# LINE 549 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:\" :: Maybe Windows.AbsDir) == Just \"a:\"",       fmap Windows.toString (Windows.maybePath "a:" :: Maybe Windows.AbsDir) == Just "a:") :-  {-# LINE 704 "src/System/Path/Internal.hs" #-}+  {-# LINE 550 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"tmp\" :: Maybe Windows.RelDir) == Just \"tmp\"",       fmap Windows.toString (Windows.maybePath "tmp" :: Maybe Windows.RelDir) == Just "tmp") :-  {-# LINE 705 "src/System/Path/Internal.hs" #-}+  {-# LINE 551 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"\\\\tmp\" :: Maybe Windows.RelDir) == Nothing",       fmap Windows.toString (Windows.maybePath "\\tmp" :: Maybe Windows.RelDir) == Nothing) :-  {-# LINE 706 "src/System/Path/Internal.hs" #-}+  {-# LINE 552 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:\\\\tmp\" :: Maybe Windows.RelDir) == Nothing",       fmap Windows.toString (Windows.maybePath "a:\\tmp" :: Maybe Windows.RelDir) == Nothing) :-  {-# LINE 707 "src/System/Path/Internal.hs" #-}+  {-# LINE 553 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"a:tmp\" :: Maybe Windows.RelDir) == Nothing",       fmap Windows.toString (Windows.maybePath "a:tmp" :: Maybe Windows.RelDir) == Nothing) :-  {-# LINE 708 "src/System/Path/Internal.hs" #-}+  {-# LINE 554 "src/System/Path/Internal.hs" #-}   ("fmap Windows.toString (Windows.maybePath \"tmp\" :: Maybe Windows.AbsDir) == Nothing",       fmap Windows.toString (Windows.maybePath "tmp" :: Maybe Windows.AbsDir) == Nothing) :-  {-# LINE 757 "src/System/Path/Internal.hs" #-}+  {-# LINE 606 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relFile \"file.txt\") == \"file.txt\"",       Posix.toString (Posix.relFile "file.txt") == "file.txt") :-  {-# LINE 758 "src/System/Path/Internal.hs" #-}+  {-# LINE 607 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relFile \"tmp\") == \"tmp\"",       Posix.toString (Posix.relFile "tmp") == "tmp") :-  {-# LINE 764 "src/System/Path/Internal.hs" #-}+  {-# LINE 613 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relDir \".\") == \".\"",       Posix.toString (Posix.relDir ".") == ".") :-  {-# LINE 765 "src/System/Path/Internal.hs" #-}+  {-# LINE 614 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relDir \"file.txt\") == \"file.txt\"",       Posix.toString (Posix.relDir "file.txt") == "file.txt") :-  {-# LINE 766 "src/System/Path/Internal.hs" #-}+  {-# LINE 615 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relDir \"tmp\") == \"tmp\"",       Posix.toString (Posix.relDir "tmp") == "tmp") :-  {-# LINE 772 "src/System/Path/Internal.hs" #-}+  {-# LINE 621 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absFile \"/file.txt\") == \"/file.txt\"",       Posix.toString (Posix.absFile "/file.txt") == "/file.txt") :-  {-# LINE 773 "src/System/Path/Internal.hs" #-}+  {-# LINE 622 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absFile \"/tmp\") == \"/tmp\"",       Posix.toString (Posix.absFile "/tmp") == "/tmp") :-  {-# LINE 779 "src/System/Path/Internal.hs" #-}+  {-# LINE 628 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absDir \"/file.txt\") == \"/file.txt\"",       Posix.toString (Posix.absDir "/file.txt") == "/file.txt") :-  {-# LINE 780 "src/System/Path/Internal.hs" #-}+  {-# LINE 629 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absDir \"/tmp\") == \"/tmp\"",       Posix.toString (Posix.absDir "/tmp") == "/tmp") :-  {-# LINE 845 "src/System/Path/Internal.hs" #-}+  {-# LINE 724 "src/System/Path/Internal.hs" #-}   ("Posix.asPath \"/tmp\" == Posix.absDir \"/tmp\"",       Posix.asPath "/tmp" == Posix.absDir "/tmp") :-  {-# LINE 846 "src/System/Path/Internal.hs" #-}+  {-# LINE 725 "src/System/Path/Internal.hs" #-}   ("Posix.asPath \"file.txt\" == Posix.relFile \"file.txt\"",       Posix.asPath "file.txt" == Posix.relFile "file.txt") :-  {-# LINE 847 "src/System/Path/Internal.hs" #-}+  {-# LINE 726 "src/System/Path/Internal.hs" #-}   ("Path.isAbsolute (Posix.asAbsDir \"/tmp\")",       Path.isAbsolute (Posix.asAbsDir "/tmp")) :-  {-# LINE 848 "src/System/Path/Internal.hs" #-}+  {-# LINE 727 "src/System/Path/Internal.hs" #-}   ("Path.isRelative (Posix.asRelDir \"/tmp\")",       Path.isRelative (Posix.asRelDir "/tmp")) :-  {-# LINE 849 "src/System/Path/Internal.hs" #-}+  {-# LINE 728 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asPath \"/tmp\" :: Posix.AbsDir) == \"/tmp\"",       Posix.toString (Posix.asPath "/tmp" :: Posix.AbsDir) == "/tmp") :-  {-# LINE 850 "src/System/Path/Internal.hs" #-}+  {-# LINE 729 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asPath \"/tmp\" :: Posix.RelDir) == \"tmp\"",       Posix.toString (Posix.asPath "/tmp" :: Posix.RelDir) == "tmp") :-  {-# LINE 851 "src/System/Path/Internal.hs" #-}+  {-# LINE 730 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.asPath \"\\\\tmp\" :: Windows.AbsDir) == \"\\\\tmp\"",       Windows.toString (Windows.asPath "\\tmp" :: Windows.AbsDir) == "\\tmp") :-  {-# LINE 852 "src/System/Path/Internal.hs" #-}+  {-# LINE 731 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.asPath \"a:\\\\tmp\" :: Windows.AbsDir) == \"a:\\\\tmp\"",       Windows.toString (Windows.asPath "a:\\tmp" :: Windows.AbsDir) == "a:\\tmp") :-  {-# LINE 853 "src/System/Path/Internal.hs" #-}+  {-# LINE 732 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.asPath \"a:tmp\" :: Windows.AbsDir) == \"a:tmp\"",       Windows.toString (Windows.asPath "a:tmp" :: Windows.AbsDir) == "a:tmp") :-  {-# LINE 854 "src/System/Path/Internal.hs" #-}+  {-# LINE 733 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.asPath \"tmp\" :: Windows.RelDir) == \"tmp\"",       Windows.toString (Windows.asPath "tmp" :: Windows.RelDir) == "tmp") :-  {-# LINE 862 "src/System/Path/Internal.hs" #-}+  {-# LINE 741 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelFile \"file.txt\") == \"file.txt\"",       Posix.toString (Posix.asRelFile "file.txt") == "file.txt") :-  {-# LINE 863 "src/System/Path/Internal.hs" #-}+  {-# LINE 742 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelFile \"/file.txt\") == \"file.txt\"",       Posix.toString (Posix.asRelFile "/file.txt") == "file.txt") :-  {-# LINE 864 "src/System/Path/Internal.hs" #-}+  {-# LINE 743 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelFile \"tmp\") == \"tmp\"",       Posix.toString (Posix.asRelFile "tmp") == "tmp") :-  {-# LINE 865 "src/System/Path/Internal.hs" #-}+  {-# LINE 744 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelFile \"/tmp\") == \"tmp\"",       Posix.toString (Posix.asRelFile "/tmp") == "tmp") :-  {-# LINE 871 "src/System/Path/Internal.hs" #-}+  {-# LINE 750 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelDir \".\") == \".\"",       Posix.toString (Posix.asRelDir ".") == ".") :-  {-# LINE 872 "src/System/Path/Internal.hs" #-}+  {-# LINE 751 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelDir \"file.txt\") == \"file.txt\"",       Posix.toString (Posix.asRelDir "file.txt") == "file.txt") :-  {-# LINE 873 "src/System/Path/Internal.hs" #-}+  {-# LINE 752 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelDir \"/file.txt\") == \"file.txt\"",       Posix.toString (Posix.asRelDir "/file.txt") == "file.txt") :-  {-# LINE 874 "src/System/Path/Internal.hs" #-}+  {-# LINE 753 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelDir \"tmp\") == \"tmp\"",       Posix.toString (Posix.asRelDir "tmp") == "tmp") :-  {-# LINE 875 "src/System/Path/Internal.hs" #-}+  {-# LINE 754 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asRelDir \"/tmp\") == \"tmp\"",       Posix.toString (Posix.asRelDir "/tmp") == "tmp") :-  {-# LINE 881 "src/System/Path/Internal.hs" #-}+  {-# LINE 760 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asAbsFile \"/file.txt\") == \"/file.txt\"",       Posix.toString (Posix.asAbsFile "/file.txt") == "/file.txt") :-  {-# LINE 882 "src/System/Path/Internal.hs" #-}+  {-# LINE 761 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asAbsFile \"/tmp\") == \"/tmp\"",       Posix.toString (Posix.asAbsFile "/tmp") == "/tmp") :-  {-# LINE 888 "src/System/Path/Internal.hs" #-}+  {-# LINE 767 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asAbsDir \"/file.txt\") == \"/file.txt\"",       Posix.toString (Posix.asAbsDir "/file.txt") == "/file.txt") :-  {-# LINE 889 "src/System/Path/Internal.hs" #-}+  {-# LINE 768 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.asAbsDir \"/tmp\") == \"/tmp\"",       Posix.toString (Posix.asAbsDir "/tmp") == "/tmp") :-  {-# LINE 926 "src/System/Path/Internal.hs" #-}+  {-# LINE 807 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel \"/tmp\" == Left (Posix.absDir \"/tmp\")",       Path.mkPathAbsOrRel "/tmp" == Left (Posix.absDir "/tmp")) :-  {-# LINE 927 "src/System/Path/Internal.hs" #-}+  {-# LINE 808 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel  \"tmp\" == Right (Posix.relDir \"tmp\")",       Path.mkPathAbsOrRel  "tmp" == Right (Posix.relDir "tmp")) :-  {-# LINE 928 "src/System/Path/Internal.hs" #-}+  {-# LINE 809 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel \"\\\\tmp\" == Left (Windows.absDir \"\\\\tmp\")",       Path.mkPathAbsOrRel "\\tmp" == Left (Windows.absDir "\\tmp")) :-  {-# LINE 929 "src/System/Path/Internal.hs" #-}+  {-# LINE 810 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel \"d:\\\\tmp\" == Left (Windows.absDir \"d:\\\\tmp\")",       Path.mkPathAbsOrRel "d:\\tmp" == Left (Windows.absDir "d:\\tmp")) :-  {-# LINE 930 "src/System/Path/Internal.hs" #-}+  {-# LINE 811 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel \"d:tmp\" == Left (Windows.absDir \"d:tmp\")",       Path.mkPathAbsOrRel "d:tmp" == Left (Windows.absDir "d:tmp")) :-  {-# LINE 931 "src/System/Path/Internal.hs" #-}+  {-# LINE 812 "src/System/Path/Internal.hs" #-}   ("Path.mkPathAbsOrRel \"tmp\" == Right (Windows.relDir \"tmp\")",       Path.mkPathAbsOrRel "tmp" == Right (Windows.relDir "tmp")) :-  {-# LINE 961 "src/System/Path/Internal.hs" #-}+  {-# LINE 841 "src/System/Path/Internal.hs" #-}   ("Path.mkAbsPath (absDir \"/tmp\") \"foo.txt\" == Posix.absFile \"/tmp/foo.txt\"",       Path.mkAbsPath (absDir "/tmp") "foo.txt" == Posix.absFile "/tmp/foo.txt") :-  {-# LINE 962 "src/System/Path/Internal.hs" #-}+  {-# LINE 842 "src/System/Path/Internal.hs" #-}   ("Path.mkAbsPath (absDir \"/tmp\") \"/etc/foo.txt\" == Posix.absFile \"/etc/foo.txt\"",       Path.mkAbsPath (absDir "/tmp") "/etc/foo.txt" == Posix.absFile "/etc/foo.txt") :-  {-# LINE 1099 "src/System/Path/Internal.hs" #-}+  {-# LINE 975 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absDir \"/tmp\" </> Posix.relFile \"file.txt\") == \"/tmp/file.txt\"",       Posix.toString (Posix.absDir "/tmp" </> Posix.relFile "file.txt") == "/tmp/file.txt") :-  {-# LINE 1100 "src/System/Path/Internal.hs" #-}+  {-# LINE 976 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.absDir \"/tmp\" </> Posix.relDir \"dir\" </> Posix.relFile \"file.txt\") == \"/tmp/dir/file.txt\"",       Posix.toString (Posix.absDir "/tmp" </> Posix.relDir "dir" </> Posix.relFile "file.txt") == "/tmp/dir/file.txt") :-  {-# LINE 1101 "src/System/Path/Internal.hs" #-}+  {-# LINE 977 "src/System/Path/Internal.hs" #-}   ("Posix.toString (Posix.relDir \"dir\" </> Posix.relFile \"file.txt\") == \"dir/file.txt\"",       Posix.toString (Posix.relDir "dir" </> Posix.relFile "file.txt") == "dir/file.txt") :-  {-# LINE 1102 "src/System/Path/Internal.hs" #-}+  {-# LINE 978 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.absDir \"\\\\tmp\" </> Windows.relFile \"file.txt\") == \"\\\\tmp\\\\file.txt\"",       Windows.toString (Windows.absDir "\\tmp" </> Windows.relFile "file.txt") == "\\tmp\\file.txt") :-  {-# LINE 1103 "src/System/Path/Internal.hs" #-}+  {-# LINE 979 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.absDir \"c:\\\\tmp\" </> Windows.relFile \"file.txt\") == \"c:\\\\tmp\\\\file.txt\"",       Windows.toString (Windows.absDir "c:\\tmp" </> Windows.relFile "file.txt") == "c:\\tmp\\file.txt") :-  {-# LINE 1104 "src/System/Path/Internal.hs" #-}+  {-# LINE 980 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.absDir \"c:tmp\" </> Windows.relFile \"file.txt\") == \"c:tmp\\\\file.txt\"",       Windows.toString (Windows.absDir "c:tmp" </> Windows.relFile "file.txt") == "c:tmp\\file.txt") :-  {-# LINE 1105 "src/System/Path/Internal.hs" #-}+  {-# LINE 981 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.absDir \"c:\\\\\" </> Windows.relDir \"tmp\" </> Windows.relFile \"file.txt\") == \"c:\\\\tmp\\\\file.txt\"",       Windows.toString (Windows.absDir "c:\\" </> Windows.relDir "tmp" </> Windows.relFile "file.txt") == "c:\\tmp\\file.txt") :-  {-# LINE 1106 "src/System/Path/Internal.hs" #-}+  {-# LINE 982 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.absDir \"c:\" </> Windows.relDir \"tmp\" </> Windows.relFile \"file.txt\") == \"c:tmp\\\\file.txt\"",       Windows.toString (Windows.absDir "c:" </> Windows.relDir "tmp" </> Windows.relFile "file.txt") == "c:tmp\\file.txt") :-  {-# LINE 1107 "src/System/Path/Internal.hs" #-}+  {-# LINE 983 "src/System/Path/Internal.hs" #-}   ("Windows.toString (Windows.relDir \"dir\" </> Windows.relFile \"file.txt\") == \"dir\\\\file.txt\"",       Windows.toString (Windows.relDir "dir" </> Windows.relFile "file.txt") == "dir\\file.txt") :-  {-# LINE 1134 "src/System/Path/Internal.hs" #-}+  {-# LINE 1010 "src/System/Path/Internal.hs" #-}   ("Path.addExtension (relFile \"file.txt\") \"bib\" == Posix.relFile \"file.txt.bib\"",       Path.addExtension (relFile "file.txt") "bib" == Posix.relFile "file.txt.bib") :-  {-# LINE 1135 "src/System/Path/Internal.hs" #-}+  {-# LINE 1011 "src/System/Path/Internal.hs" #-}   ("Path.addExtension (relFile \"file.\") \".bib\" == Posix.relFile \"file..bib\"",       Path.addExtension (relFile "file.") ".bib" == Posix.relFile "file..bib") :-  {-# LINE 1136 "src/System/Path/Internal.hs" #-}+  {-# LINE 1012 "src/System/Path/Internal.hs" #-}   ("Path.addExtension (relFile \"file\") \".bib\" == Posix.relFile \"file.bib\"",       Path.addExtension (relFile "file") ".bib" == Posix.relFile "file.bib") :-  {-# LINE 1137 "src/System/Path/Internal.hs" #-}+  {-# LINE 1013 "src/System/Path/Internal.hs" #-}   ("Path.addExtension Path.emptyFile \"bib\" == Posix.relFile \".bib\"",       Path.addExtension Path.emptyFile "bib" == Posix.relFile ".bib") :-  {-# LINE 1138 "src/System/Path/Internal.hs" #-}+  {-# LINE 1014 "src/System/Path/Internal.hs" #-}   ("Path.addExtension Path.emptyFile \".bib\" == Posix.relFile \".bib\"",       Path.addExtension Path.emptyFile ".bib" == Posix.relFile ".bib") :-  {-# LINE 1139 "src/System/Path/Internal.hs" #-}+  {-# LINE 1015 "src/System/Path/Internal.hs" #-}   ("Path.takeFileName (Path.addExtension Path.emptyFile \"ext\") == Posix.relFile \".ext\"",       Path.takeFileName (Path.addExtension Path.emptyFile "ext") == Posix.relFile ".ext") :-  {-# LINE 1154 "src/System/Path/Internal.hs" #-}+  {-# LINE 1030 "src/System/Path/Internal.hs" #-}   ("Path.dropExtension x == fst (Path.splitExtension x)",       Path.dropExtension x == fst (Path.splitExtension x)) :-  {-# LINE 1160 "src/System/Path/Internal.hs" #-}+  {-# LINE 1036 "src/System/Path/Internal.hs" #-}   ("not $ Path.hasAnExtension (Path.dropExtensions x)",       not $ Path.hasAnExtension (Path.dropExtensions x)) :-  {-# LINE 1171 "src/System/Path/Internal.hs" #-}+  {-# LINE 1047 "src/System/Path/Internal.hs" #-}   ("Path.replaceExtension (relFile \"file.txt\") \".bob\" == Posix.relFile \"file.bob\"",       Path.replaceExtension (relFile "file.txt") ".bob" == Posix.relFile "file.bob") :-  {-# LINE 1172 "src/System/Path/Internal.hs" #-}+  {-# LINE 1048 "src/System/Path/Internal.hs" #-}   ("Path.replaceExtension (relFile \"file.txt\") \"bob\" == Posix.relFile \"file.bob\"",       Path.replaceExtension (relFile "file.txt") "bob" == Posix.relFile "file.bob") :-  {-# LINE 1173 "src/System/Path/Internal.hs" #-}+  {-# LINE 1049 "src/System/Path/Internal.hs" #-}   ("Path.replaceExtension (relFile \"file\") \".bob\" == Posix.relFile \"file.bob\"",       Path.replaceExtension (relFile "file") ".bob" == Posix.relFile "file.bob") :-  {-# LINE 1174 "src/System/Path/Internal.hs" #-}+  {-# LINE 1050 "src/System/Path/Internal.hs" #-}   ("Path.replaceExtension (relFile \"file.txt\") \"\" == Posix.relFile \"file\"",       Path.replaceExtension (relFile "file.txt") "" == Posix.relFile "file") :-  {-# LINE 1175 "src/System/Path/Internal.hs" #-}+  {-# LINE 1051 "src/System/Path/Internal.hs" #-}   ("Path.replaceExtension (relFile \"file.fred.bob\") \"txt\" == Posix.relFile \"file.fred.txt\"",       Path.replaceExtension (relFile "file.fred.bob") "txt" == Posix.relFile "file.fred.txt") :-  {-# LINE 1192 "src/System/Path/Internal.hs" #-}+  {-# LINE 1068 "src/System/Path/Internal.hs" #-}   ("uncurry (<.>) (Path.splitExtension x) == x",       uncurry (<.>) (Path.splitExtension x) == x) :-  {-# LINE 1193 "src/System/Path/Internal.hs" #-}+  {-# LINE 1069 "src/System/Path/Internal.hs" #-}   ("uncurry Path.addExtension (Path.splitExtension x) == x",       uncurry Path.addExtension (Path.splitExtension x) == x) :-  {-# LINE 1194 "src/System/Path/Internal.hs" #-}+  {-# LINE 1070 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file.txt\") == (Posix.relFile \"file\",\".txt\")",       Path.splitExtension (relFile "file.txt") == (Posix.relFile "file",".txt")) :-  {-# LINE 1195 "src/System/Path/Internal.hs" #-}+  {-# LINE 1071 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \".bashrc\") == (Posix.emptyFile, \".bashrc\")",       Path.splitExtension (relFile ".bashrc") == (Posix.emptyFile, ".bashrc")) :-  {-# LINE 1196 "src/System/Path/Internal.hs" #-}+  {-# LINE 1072 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file\") == (Posix.relFile \"file\",\"\")",       Path.splitExtension (relFile "file") == (Posix.relFile "file","")) :-  {-# LINE 1197 "src/System/Path/Internal.hs" #-}+  {-# LINE 1073 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file/file.txt\") == (Posix.relFile \"file/file\",\".txt\")",       Path.splitExtension (relFile "file/file.txt") == (Posix.relFile "file/file",".txt")) :-  {-# LINE 1198 "src/System/Path/Internal.hs" #-}+  {-# LINE 1074 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file.txt/boris\") == (Posix.relFile \"file.txt/boris\",\"\")",       Path.splitExtension (relFile "file.txt/boris") == (Posix.relFile "file.txt/boris","")) :-  {-# LINE 1199 "src/System/Path/Internal.hs" #-}+  {-# LINE 1075 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file.txt/boris.ext\") == (Posix.relFile \"file.txt/boris\",\".ext\")",       Path.splitExtension (relFile "file.txt/boris.ext") == (Posix.relFile "file.txt/boris",".ext")) :-  {-# LINE 1200 "src/System/Path/Internal.hs" #-}+  {-# LINE 1076 "src/System/Path/Internal.hs" #-}   ("Path.splitExtension (relFile \"file/path.txt.bob.fred\") == (Posix.relFile \"file/path.txt.bob\",\".fred\")",       Path.splitExtension (relFile "file/path.txt.bob.fred") == (Posix.relFile "file/path.txt.bob",".fred")) :-  {-# LINE 1206 "src/System/Path/Internal.hs" #-}+  {-# LINE 1082 "src/System/Path/Internal.hs" #-}   ("Path.splitExtensions (relFile \"file.tar.gz\") == (Posix.relFile \"file\",\".tar.gz\")",       Path.splitExtensions (relFile "file.tar.gz") == (Posix.relFile "file",".tar.gz")) :-  {-# LINE 1222 "src/System/Path/Internal.hs" #-}+  {-# LINE 1106 "src/System/Path/Internal.hs" #-}   ("Path.takeBaseName (absFile \"/tmp/somedir/myfile.txt\") == Posix.relFile \"myfile\"",       Path.takeBaseName (absFile "/tmp/somedir/myfile.txt") == Posix.relFile "myfile") :-  {-# LINE 1223 "src/System/Path/Internal.hs" #-}+  {-# LINE 1107 "src/System/Path/Internal.hs" #-}   ("Path.takeBaseName (relFile \"./myfile.txt\") == Posix.relFile \"myfile\"",       Path.takeBaseName (relFile "./myfile.txt") == Posix.relFile "myfile") :-  {-# LINE 1224 "src/System/Path/Internal.hs" #-}+  {-# LINE 1108 "src/System/Path/Internal.hs" #-}   ("Path.takeBaseName (relFile \"myfile.txt\") == Posix.relFile \"myfile\"",       Path.takeBaseName (relFile "myfile.txt") == Posix.relFile "myfile") :-  {-# LINE 1233 "src/System/Path/Internal.hs" #-}+  {-# LINE 1115 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.absDir \"/tmp/somedir\") == Just (absDir \"/tmp\")",+      Path.takeSuperDirectory (Posix.absDir "/tmp/somedir") == Just (absDir "/tmp")) :+  {-# LINE 1116 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.absDir \"/tmp/\") == Just (absDir \"/\")",+      Path.takeSuperDirectory (Posix.absDir "/tmp/") == Just (absDir "/")) :+  {-# LINE 1117 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.absDir \"/\") == Nothing",+      Path.takeSuperDirectory (Posix.absDir "/") == Nothing) :+  {-# LINE 1118 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.relDir \"tmp/somedir\") == Just (relDir \"tmp\")",+      Path.takeSuperDirectory (Posix.relDir "tmp/somedir") == Just (relDir "tmp")) :+  {-# LINE 1119 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.relDir \"./somedir\") == Just (relDir \".\")",+      Path.takeSuperDirectory (Posix.relDir "./somedir") == Just (relDir ".")) :+  {-# LINE 1120 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.relDir \"somedir\") == Just Path.currentDir",+      Path.takeSuperDirectory (Posix.relDir "somedir") == Just Path.currentDir) :+  {-# LINE 1121 "src/System/Path/Internal.hs" #-}+  ("Path.takeSuperDirectory (Posix.relDir \"\") == Nothing",+      Path.takeSuperDirectory (Posix.relDir "") == Nothing) :+  {-# LINE 1127 "src/System/Path/Internal.hs" #-}   ("Path.takeExtension x == snd (Path.splitExtension x)",       Path.takeExtension x == snd (Path.splitExtension x)) :-  {-# LINE 1234 "src/System/Path/Internal.hs" #-}+  {-# LINE 1128 "src/System/Path/Internal.hs" #-}   ("Path.takeExtension (Path.addExtension x \"ext\") == \".ext\"",       Path.takeExtension (Path.addExtension x "ext") == ".ext") :-  {-# LINE 1235 "src/System/Path/Internal.hs" #-}+  {-# LINE 1129 "src/System/Path/Internal.hs" #-}   ("Path.takeExtension (Path.replaceExtension x \"ext\") == \".ext\"",       Path.takeExtension (Path.replaceExtension x "ext") == ".ext") :-  {-# LINE 1241 "src/System/Path/Internal.hs" #-}+  {-# LINE 1135 "src/System/Path/Internal.hs" #-}   ("Path.takeExtensions (Posix.relFile \"file.tar.gz\") == \".tar.gz\"",       Path.takeExtensions (Posix.relFile "file.tar.gz") == ".tar.gz") :-  {-# LINE 1247 "src/System/Path/Internal.hs" #-}+  {-# LINE 1141 "src/System/Path/Internal.hs" #-}   ("Path.takeFileName (absFile \"/tmp/somedir/myfile.txt\") == Posix.relFile \"myfile.txt\"",       Path.takeFileName (absFile "/tmp/somedir/myfile.txt") == Posix.relFile "myfile.txt") :-  {-# LINE 1248 "src/System/Path/Internal.hs" #-}+  {-# LINE 1142 "src/System/Path/Internal.hs" #-}   ("Path.takeFileName (relFile \"./myfile.txt\") == Posix.relFile \"myfile.txt\"",       Path.takeFileName (relFile "./myfile.txt") == Posix.relFile "myfile.txt") :-  {-# LINE 1249 "src/System/Path/Internal.hs" #-}+  {-# LINE 1143 "src/System/Path/Internal.hs" #-}   ("Path.takeFileName (relFile \"myfile.txt\") == Posix.relFile \"myfile.txt\"",       Path.takeFileName (relFile "myfile.txt") == Posix.relFile "myfile.txt") :-  {-# LINE 1266 "src/System/Path/Internal.hs" #-}+  {-# LINE 1175 "src/System/Path/Internal.hs" #-}   ("      Posix.equalFilePath \"abc/def\" \"abc/def\"",             Posix.equalFilePath "abc/def" "abc/def") :-  {-# LINE 1267 "src/System/Path/Internal.hs" #-}+  {-# LINE 1176 "src/System/Path/Internal.hs" #-}   ("      Posix.equalFilePath \"abc/def\" \"abc//def\"",             Posix.equalFilePath "abc/def" "abc//def") :-  {-# LINE 1268 "src/System/Path/Internal.hs" #-}+  {-# LINE 1177 "src/System/Path/Internal.hs" #-}   ("      Posix.equalFilePath \"/tmp/\" \"/tmp\"",             Posix.equalFilePath "/tmp/" "/tmp") :-  {-# LINE 1269 "src/System/Path/Internal.hs" #-}+  {-# LINE 1178 "src/System/Path/Internal.hs" #-}   ("      Posix.equalFilePath \"/tmp\" \"//tmp\"",             Posix.equalFilePath "/tmp" "//tmp") :-  {-# LINE 1270 "src/System/Path/Internal.hs" #-}+  {-# LINE 1179 "src/System/Path/Internal.hs" #-}   ("      Posix.equalFilePath \"/tmp\" \"///tmp\"",             Posix.equalFilePath "/tmp" "///tmp") :-  {-# LINE 1271 "src/System/Path/Internal.hs" #-}+  {-# LINE 1180 "src/System/Path/Internal.hs" #-}   ("not $ Posix.equalFilePath \"abc\" \"def\"",       not $ Posix.equalFilePath "abc" "def") :-  {-# LINE 1272 "src/System/Path/Internal.hs" #-}+  {-# LINE 1181 "src/System/Path/Internal.hs" #-}   ("not $ Posix.equalFilePath \"/tmp\" \"tmp\"",       not $ Posix.equalFilePath "/tmp" "tmp") :-  {-# LINE 1273 "src/System/Path/Internal.hs" #-}+  {-# LINE 1182 "src/System/Path/Internal.hs" #-}   ("      Windows.equalFilePath \"abc\\\\def\" \"abc\\\\def\"",             Windows.equalFilePath "abc\\def" "abc\\def") :-  {-# LINE 1274 "src/System/Path/Internal.hs" #-}+  {-# LINE 1183 "src/System/Path/Internal.hs" #-}   ("      Windows.equalFilePath \"abc\\\\def\" \"abc\\\\\\\\def\"",             Windows.equalFilePath "abc\\def" "abc\\\\def") :-  {-# LINE 1275 "src/System/Path/Internal.hs" #-}+  {-# LINE 1184 "src/System/Path/Internal.hs" #-}   ("      Windows.equalFilePath \"file\" \"File\"",             Windows.equalFilePath "file" "File") :-  {-# LINE 1276 "src/System/Path/Internal.hs" #-}+  {-# LINE 1185 "src/System/Path/Internal.hs" #-}   ("      Windows.equalFilePath \"\\\\file\" \"\\\\\\\\file\"",             Windows.equalFilePath "\\file" "\\\\file") :-  {-# LINE 1277 "src/System/Path/Internal.hs" #-}+  {-# LINE 1186 "src/System/Path/Internal.hs" #-}   ("      Windows.equalFilePath \"\\\\file\" \"\\\\\\\\\\\\file\"",             Windows.equalFilePath "\\file" "\\\\\\file") :-  {-# LINE 1278 "src/System/Path/Internal.hs" #-}+  {-# LINE 1187 "src/System/Path/Internal.hs" #-}   ("not $ Windows.equalFilePath \"abc\" \"def\"",       not $ Windows.equalFilePath "abc" "def") :-  {-# LINE 1279 "src/System/Path/Internal.hs" #-}+  {-# LINE 1188 "src/System/Path/Internal.hs" #-}   ("not $ Windows.equalFilePath \"file\" \"dir\"",       not $ Windows.equalFilePath "file" "dir") :-  {-# LINE 1292 "src/System/Path/Internal.hs" #-}+  {-# LINE 1201 "src/System/Path/Internal.hs" #-}   ("Path.joinPath [\"tmp\",\"someDir\",\"dir\"] == Posix.relDir \"tmp/someDir/dir\"",       Path.joinPath ["tmp","someDir","dir"] == Posix.relDir "tmp/someDir/dir") :-  {-# LINE 1293 "src/System/Path/Internal.hs" #-}+  {-# LINE 1202 "src/System/Path/Internal.hs" #-}   ("Path.joinPath [\"tmp\",\"someDir\",\"file.txt\"] == Posix.relFile \"tmp/someDir/file.txt\"",       Path.joinPath ["tmp","someDir","file.txt"] == Posix.relFile "tmp/someDir/file.txt") :-  {-# LINE 1299 "src/System/Path/Internal.hs" #-}+  {-# LINE 1208 "src/System/Path/Internal.hs" #-}   ("Path.normalise (absFile \"/tmp/fred/./jim/./file\") == Posix.absFile \"/tmp/fred/jim/file\"",       Path.normalise (absFile "/tmp/fred/./jim/./file") == Posix.absFile "/tmp/fred/jim/file") :-  {-# LINE 1305 "src/System/Path/Internal.hs" #-}+  {-# LINE 1214 "src/System/Path/Internal.hs" #-}   ("Path.splitPath (Posix.absDir \"/tmp/someDir/mydir.dir\") == (True, map relDir [\"tmp\",\"someDir\",\"mydir.dir\"], Nothing)",       Path.splitPath (Posix.absDir "/tmp/someDir/mydir.dir") == (True, map relDir ["tmp","someDir","mydir.dir"], Nothing)) :-  {-# LINE 1306 "src/System/Path/Internal.hs" #-}+  {-# LINE 1215 "src/System/Path/Internal.hs" #-}   ("Path.splitPath (Posix.absFile \"/tmp/someDir/myfile.txt\") == (True, map relDir [\"tmp\",\"someDir\"], Just $ relFile \"myfile.txt\")",       Path.splitPath (Posix.absFile "/tmp/someDir/myfile.txt") == (True, map relDir ["tmp","someDir"], Just $ relFile "myfile.txt")) :-  {-# LINE 1325 "src/System/Path/Internal.hs" #-}+  {-# LINE 1231 "src/System/Path/Internal.hs" #-}   ("Path.makeRelative (absDir \"/tmp/somedir\") (absFile \"/tmp/somedir/anotherdir/file.txt\") == Posix.relFile \"anotherdir/file.txt\"",       Path.makeRelative (absDir "/tmp/somedir") (absFile "/tmp/somedir/anotherdir/file.txt") == Posix.relFile "anotherdir/file.txt") :-  {-# LINE 1326 "src/System/Path/Internal.hs" #-}+  {-# LINE 1232 "src/System/Path/Internal.hs" #-}   ("Path.makeRelative (absDir \"/tmp/somedir\") (absDir \"/tmp/somedir/anotherdir/dir\") == Posix.relDir \"anotherdir/dir\"",       Path.makeRelative (absDir "/tmp/somedir") (absDir "/tmp/somedir/anotherdir/dir") == Posix.relDir "anotherdir/dir") :-  {-# LINE 1327 "src/System/Path/Internal.hs" #-}+  {-# LINE 1233 "src/System/Path/Internal.hs" #-}   ("Path.makeRelative (absDir \"c:\\\\tmp\\\\somedir\") (absFile \"C:\\\\Tmp\\\\SomeDir\\\\AnotherDir\\\\File.txt\") == Windows.relFile \"AnotherDir\\\\File.txt\"",       Path.makeRelative (absDir "c:\\tmp\\somedir") (absFile "C:\\Tmp\\SomeDir\\AnotherDir\\File.txt") == Windows.relFile "AnotherDir\\File.txt") :-  {-# LINE 1328 "src/System/Path/Internal.hs" #-}+  {-# LINE 1234 "src/System/Path/Internal.hs" #-}   ("Path.makeRelative (absDir \"c:\\\\tmp\\\\somedir\") (absDir \"c:\\\\tmp\\\\somedir\\\\anotherdir\\\\dir\") == Windows.relDir \"anotherdir\\\\dir\"",       Path.makeRelative (absDir "c:\\tmp\\somedir") (absDir "c:\\tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir") :-  {-# LINE 1329 "src/System/Path/Internal.hs" #-}+  {-# LINE 1235 "src/System/Path/Internal.hs" #-}   ("Path.makeRelative (absDir \"c:tmp\\\\somedir\") (absDir \"c:tmp\\\\somedir\\\\anotherdir\\\\dir\") == Windows.relDir \"anotherdir\\\\dir\"",       Path.makeRelative (absDir "c:tmp\\somedir") (absDir "c:tmp\\somedir\\anotherdir\\dir") == Windows.relDir "anotherdir\\dir") :-  {-# LINE 1340 "src/System/Path/Internal.hs" #-}+  {-# LINE 1246 "src/System/Path/Internal.hs" #-}   ("Path.makeRelativeMaybe (Posix.absDir \"/tmp/somedir\") (absFile \"/tmp/anotherdir/file.txt\") == Nothing",       Path.makeRelativeMaybe (Posix.absDir "/tmp/somedir") (absFile "/tmp/anotherdir/file.txt") == Nothing) :-  {-# LINE 1341 "src/System/Path/Internal.hs" #-}+  {-# LINE 1247 "src/System/Path/Internal.hs" #-}   ("Path.makeRelativeMaybe (Posix.absDir \"/Tmp\") (absFile \"/tmp/anotherdir/file.txt\") == Nothing",       Path.makeRelativeMaybe (Posix.absDir "/Tmp") (absFile "/tmp/anotherdir/file.txt") == Nothing) :-  {-# LINE 1342 "src/System/Path/Internal.hs" #-}+  {-# LINE 1248 "src/System/Path/Internal.hs" #-}   ("Path.makeRelativeMaybe (Windows.absDir \"\\\\Tmp\") (absFile \"\\\\tmp\\\\anotherdir\\\\file.txt\") == Just (relFile \"anotherdir\\\\file.txt\")",       Path.makeRelativeMaybe (Windows.absDir "\\Tmp") (absFile "\\tmp\\anotherdir\\file.txt") == Just (relFile "anotherdir\\file.txt")) :-  {-# LINE 1356 "src/System/Path/Internal.hs" #-}+  {-# LINE 1262 "src/System/Path/Internal.hs" #-}   ("Path.makeAbsolute (absDir \"/tmp\") (relFile \"file.txt\")      == Posix.absFile \"/tmp/file.txt\"",       Path.makeAbsolute (absDir "/tmp") (relFile "file.txt")      == Posix.absFile "/tmp/file.txt") :-  {-# LINE 1357 "src/System/Path/Internal.hs" #-}+  {-# LINE 1263 "src/System/Path/Internal.hs" #-}   ("Path.makeAbsolute (absDir \"/tmp\") (relFile \"adir/file.txt\") == Posix.absFile \"/tmp/adir/file.txt\"",       Path.makeAbsolute (absDir "/tmp") (relFile "adir/file.txt") == Posix.absFile "/tmp/adir/file.txt") :-  {-# LINE 1358 "src/System/Path/Internal.hs" #-}+  {-# LINE 1264 "src/System/Path/Internal.hs" #-}   ("Path.makeAbsolute (absDir \"/tmp\") (relDir  \"adir/dir\")      == Posix.absDir \"/tmp/adir/dir\"",       Path.makeAbsolute (absDir "/tmp") (relDir  "adir/dir")      == Posix.absDir "/tmp/adir/dir") :-  {-# LINE 1380 "src/System/Path/Internal.hs" #-}+  {-# LINE 1286 "src/System/Path/Internal.hs" #-}   ("Path.genericMakeAbsolute (absDir \"/tmp\") (relFile \"file.txt\")       == Posix.absFile \"/tmp/file.txt\"",       Path.genericMakeAbsolute (absDir "/tmp") (relFile "file.txt")       == Posix.absFile "/tmp/file.txt") :-  {-# LINE 1381 "src/System/Path/Internal.hs" #-}+  {-# LINE 1287 "src/System/Path/Internal.hs" #-}   ("Path.genericMakeAbsolute (absDir \"/tmp\") (relFile \"adir/file.txt\")  == Posix.absFile \"/tmp/adir/file.txt\"",       Path.genericMakeAbsolute (absDir "/tmp") (relFile "adir/file.txt")  == Posix.absFile "/tmp/adir/file.txt") :-  {-# LINE 1382 "src/System/Path/Internal.hs" #-}+  {-# LINE 1288 "src/System/Path/Internal.hs" #-}   ("Path.genericMakeAbsolute (absDir \"/tmp\") (absFile \"/adir/file.txt\") == Posix.absFile \"/adir/file.txt\"",       Path.genericMakeAbsolute (absDir "/tmp") (absFile "/adir/file.txt") == Posix.absFile "/adir/file.txt") :-  {-# LINE 1467 "src/System/Path/Internal.hs" #-}+  {-# LINE 1376 "src/System/Path/Internal.hs" #-}   ("Path.isAbsolute (Posix.absFile \"/fred\")",       Path.isAbsolute (Posix.absFile "/fred")) :-  {-# LINE 1468 "src/System/Path/Internal.hs" #-}+  {-# LINE 1377 "src/System/Path/Internal.hs" #-}   ("Path.isAbsolute (Windows.absFile \"\\\\fred\")",       Path.isAbsolute (Windows.absFile "\\fred")) :-  {-# LINE 1469 "src/System/Path/Internal.hs" #-}+  {-# LINE 1378 "src/System/Path/Internal.hs" #-}   ("Path.isAbsolute (Windows.absFile \"c:\\\\fred\")",       Path.isAbsolute (Windows.absFile "c:\\fred")) :-  {-# LINE 1470 "src/System/Path/Internal.hs" #-}+  {-# LINE 1379 "src/System/Path/Internal.hs" #-}   ("Path.isAbsolute (Windows.absFile \"c:fred\")",       Path.isAbsolute (Windows.absFile "c:fred")) :-  {-# LINE 1477 "src/System/Path/Internal.hs" #-}+  {-# LINE 1386 "src/System/Path/Internal.hs" #-}   ("Path.isRelative (Posix.relFile \"fred\")",       Path.isRelative (Posix.relFile "fred")) :-  {-# LINE 1478 "src/System/Path/Internal.hs" #-}+  {-# LINE 1387 "src/System/Path/Internal.hs" #-}   ("Path.isRelative (Windows.relFile \"fred\")",       Path.isRelative (Windows.relFile "fred")) :-  {-# LINE 1503 "src/System/Path/Internal.hs" #-}+  {-# LINE 1412 "src/System/Path/Internal.hs" #-}   ("null (Path.takeExtension x) == not (Path.hasAnExtension x)",       null (Path.takeExtension x) == not (Path.hasAnExtension x)) :-  {-# LINE 1509 "src/System/Path/Internal.hs" #-}+  {-# LINE 1418 "src/System/Path/Internal.hs" #-}   ("Path.hasExtension \".hs\" (Posix.relFile \"MyCode.hs\")",       Path.hasExtension ".hs" (Posix.relFile "MyCode.hs")) :-  {-# LINE 1510 "src/System/Path/Internal.hs" #-}+  {-# LINE 1419 "src/System/Path/Internal.hs" #-}   ("Path.hasExtension \".hs\" (Posix.relFile \"MyCode.bak.hs\")",       Path.hasExtension ".hs" (Posix.relFile "MyCode.bak.hs")) :-  {-# LINE 1511 "src/System/Path/Internal.hs" #-}+  {-# LINE 1420 "src/System/Path/Internal.hs" #-}   ("not $ Path.hasExtension \".hs\" (Posix.relFile \"MyCode.hs.bak\")",       not $ Path.hasExtension ".hs" (Posix.relFile "MyCode.hs.bak")) :-  {-# LINE 1521 "src/System/Path/Internal.hs" #-}+  {-# LINE 1430 "src/System/Path/Internal.hs" #-}   ("Posix.extSeparator == '.'",       Posix.extSeparator == '.') :-  {-# LINE 1532 "src/System/Path/Internal.hs" #-}+  {-# LINE 1441 "src/System/Path/Internal.hs" #-}   ("Posix.isExtSeparator a == (a == Posix.extSeparator)",       Posix.isExtSeparator a == (a == Posix.extSeparator)) :-  {-# LINE 1538 "src/System/Path/Internal.hs" #-}+  {-# LINE 1447 "src/System/Path/Internal.hs" #-}   ("Posix.isSearchPathSeparator a == (a == Posix.searchPathSeparator)",       Posix.isSearchPathSeparator a == (a == Posix.searchPathSeparator)) :-  {-# LINE 1554 "src/System/Path/Internal.hs" #-}+  {-# LINE 1463 "src/System/Path/Internal.hs" #-}   ("Path.genericAddExtension (absDir \"/\") \"x\" == Posix.absDir \"/.x\"",       Path.genericAddExtension (absDir "/") "x" == Posix.absDir "/.x") :-  {-# LINE 1555 "src/System/Path/Internal.hs" #-}+  {-# LINE 1464 "src/System/Path/Internal.hs" #-}   ("Path.genericAddExtension (absDir \"/a\") \"x\" == Posix.absDir \"/a.x\"",       Path.genericAddExtension (absDir "/a") "x" == Posix.absDir "/a.x") :-  {-# LINE 1556 "src/System/Path/Internal.hs" #-}+  {-# LINE 1465 "src/System/Path/Internal.hs" #-}   ("Path.genericAddExtension Path.emptyFile \"x\" == Posix.relFile \".x\"",       Path.genericAddExtension Path.emptyFile "x" == Posix.relFile ".x") :-  {-# LINE 1557 "src/System/Path/Internal.hs" #-}+  {-# LINE 1466 "src/System/Path/Internal.hs" #-}   ("Path.genericAddExtension Path.emptyFile \"\" == Posix.emptyFile",       Path.genericAddExtension Path.emptyFile "" == Posix.emptyFile) :-  {-# LINE 1695 "src/System/Path/Internal.hs" #-}-  ("Posix.isPathSeparator Posix.pathSeparator",-          Posix.isPathSeparator Posix.pathSeparator) :-  {-# LINE 1700 "src/System/Path/Internal.hs" #-}-  ("Posix.pathSeparator `elem` Posix.pathSeparators",-          Posix.pathSeparator `elem` Posix.pathSeparators) :-  {-# LINE 1707 "src/System/Path/Internal.hs" #-}-  ("Posix.isPathSeparator a == (a `elem` Posix.pathSeparators)",-          Posix.isPathSeparator a == (a `elem` Posix.pathSeparators)) :   []
test/TestTemplate.hs view
@@ -1,6 +1,7 @@ {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} module TestResult (results) where +import qualified System.Path.PartClass as Class import qualified System.Path.Generic as Path import qualified System.Path.Posix as Posix import qualified System.Path.Windows as Windows@@ -8,8 +9,7 @@ import Data.Char (toLower)  -results ::-  (Path.AbsRelClass ar) => Char -> Posix.FilePath ar -> [(String, Bool)]+results :: (Class.AbsRel ar) => Char -> Posix.FilePath ar -> [(String, Bool)] results a x =   <TESTS_GO_HERE>   []