Skip to content

Commit 25a863d

Browse files
committed
add AnyDir and AnyFile
1 parent ab1dc30 commit 25a863d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Pathy.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Pathy
77
, module Pathy.Sandboxed
88
) where
99

10-
import Pathy.Path (AbsDir, AbsFile, AbsPath, AnyPath, Path, RelDir, RelFile, RelPath, appendPath, currentDir, dir, dir', extendPath, file, file', fileName, foldPath, name, parentAppend, parentOf, peel, peelFile, refine, relativeTo, rename, renameTraverse, rootDir, setExtension, (<..>), (<.>), (</>))
10+
import Pathy.Path (AbsDir, AbsFile, AbsPath, AnyPath, AnyDir, AnyFile, Path, RelDir, RelFile, RelPath, appendPath, currentDir, dir, dir', extendPath, file, file', fileName, foldPath, name, parentAppend, parentOf, peel, peelFile, refine, relativeTo, rename, renameTraverse, rootDir, setExtension, (<..>), (<.>), (</>))
1111
import Pathy.Name (Name(..), joinName, splitName, alterExtension, extension)
1212
import Pathy.Printer (Escaper(..), Printer, debugPrintPath, posixPrinter, printPath, unsafePrintPath, windowsPrinter)
1313
import Pathy.Parser (Parser(..), parseAbsDir, parseAbsFile, parsePath, parseRelDir, parseRelFile, posixParser)

src/Pathy/Path.purs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ module Pathy.Path
55
, AbsPath
66
, RelDir
77
, AbsDir
8+
, AnyDir
89
, RelFile
910
, AbsFile
11+
, AnyFile
1012
, rootDir
1113
, currentDir
1214
, dir
@@ -85,13 +87,19 @@ type RelDir = Path Rel Dir
8587
-- | A type describing a directory whose location is absolutely specified.
8688
type AbsDir = Path Abs Dir
8789

90+
-- | A type describing a absolute or relative directory path.
91+
type AnyDir = Either AbsDir RelDir
92+
8893
-- | A type describing a file whose location is given relative to some other,
8994
-- | unspecified directory (referred to as the "current directory").
9095
type RelFile = Path Rel File
9196

9297
-- | A type describing a file whose location is absolutely specified.
9398
type AbsFile = Path Abs File
9499

100+
-- | A type describing a absolute or relative file path.
101+
type AnyFile = Either AbsFile RelFile
102+
95103
-- | The root directory, which can be used to define absolutely-located resources.
96104
rootDir :: Path Abs Dir
97105
rootDir = Init

0 commit comments

Comments
 (0)