@@ -59,6 +59,14 @@ newtype FileName
59
59
60
60
A newtype around a file name.
61
61
62
+ #### ` runFileName `
63
+
64
+ ``` purescript
65
+ runFileName :: FileName -> String
66
+ ```
67
+
68
+ Unwraps the ` FileName ` newtype.
69
+
62
70
#### ` DirName `
63
71
64
72
``` purescript
@@ -68,28 +76,36 @@ newtype DirName
68
76
69
77
A newtype around a directory name.
70
78
79
+ #### ` runDirName `
80
+
81
+ ``` purescript
82
+ runDirName :: DirName -> String
83
+ ```
84
+
85
+ Unwraps the ` DirName ` newtype.
86
+
71
87
#### ` Path `
72
88
73
89
``` purescript
74
90
data Path a b s
75
91
```
76
92
77
- A type that describes a Path. All flavors of paths are described by this
78
- type, whether they are absolute or relative paths, whether they
93
+ A type that describes a Path. All flavors of paths are described by this
94
+ type, whether they are absolute or relative paths, whether they
79
95
refer to files or directories, whether they are sandboxed or not.
80
96
81
97
* The type parameter ` a ` describes whether the path is ` Rel ` or ` Abs ` .
82
98
* The type parameter ` b ` describes whether the path is ` File ` or ` Dir ` .
83
99
* The type parameter ` s ` describes whether the path is ` Sandboxed ` or ` Unsandboxed ` .
84
100
85
- To ensure type safety, there is no way for users to create a value of
101
+ To ensure type safety, there is no way for users to create a value of
86
102
this type directly. Instead, helpers should be used, such as ` rootDir ` ,
87
103
` currentDir ` , ` file ` , ` dir ` , ` (</>) ` , and ` parsePath ` .
88
104
89
105
This ADT allows invalid paths (e.g. paths inside files), but there is no
90
106
possible way for such paths to be constructed by user-land code. The only
91
107
"invalid path" that may be constructed is using the ` parentDir' ` function, e.g.
92
- ` parentDir' rootDir ` , or by parsing an equivalent string such as ` /../ ` ,
108
+ ` parentDir' rootDir ` , or by parsing an equivalent string such as ` /../ ` ,
93
109
but such paths are marked as unsandboxed, and may not be rendered to strings
94
110
until they are first sandboxed to some directory.
95
111
@@ -116,7 +132,7 @@ A type describing a file whose location is absolutely specified.
116
132
type RelDir s = Path Rel Dir s
117
133
```
118
134
119
- A type describing a directory whose location is given relative to some
135
+ A type describing a directory whose location is given relative to some
120
136
other, unspecified directory (referred to as the "current directory").
121
137
122
138
#### ` AbsDir `
@@ -223,7 +239,7 @@ Creates a path which points to a relative directory of the specified name.
223
239
dirName :: forall a s. Path a Dir s -> Maybe DirName
224
240
```
225
241
226
- Retrieves the name of a directory path. Not all paths have such a name,
242
+ Retrieves the name of a directory path. Not all paths have such a name,
227
243
for example, the root or current directory.
228
244
229
245
#### ` (</>) `
@@ -252,7 +268,7 @@ file "image" <.> "png"
252
268
(<..>) :: forall a b s s'. Path a Dir s -> Path Rel b s' -> Path a b Unsandboxed
253
269
```
254
270
255
- Ascends into the parent of the specified directory, then descends into
271
+ Ascends into the parent of the specified directory, then descends into
256
272
the specified path. The result is always unsandboxed because it may escape
257
273
its previous sandbox.
258
274
@@ -278,9 +294,9 @@ Determines if this path is relatively located.
278
294
peel :: forall a b s. Path a b s -> Maybe (Tuple (Path a Dir s) (Either DirName FileName))
279
295
```
280
296
281
- Peels off the last directory and the terminal file or directory name
282
- from the path. Returns ` Nothing ` if there is no such pair (for example,
283
- if the last path segment is root directory, current directory, or parent
297
+ Peels off the last directory and the terminal file or directory name
298
+ from the path. Returns ` Nothing ` if there is no such pair (for example,
299
+ if the last path segment is root directory, current directory, or parent
284
300
directory).
285
301
286
302
#### ` maybeDir `
@@ -330,7 +346,7 @@ Returns the depth of the path. This may be negative in some cases, e.g.
330
346
parentDir :: forall a b s. Path a b s -> Maybe (Path a Dir s)
331
347
```
332
348
333
- Attempts to extract out the parent directory of the specified path. If the
349
+ Attempts to extract out the parent directory of the specified path. If the
334
350
function would have to use a relative path in the return value, the function will
335
351
instead return ` Nothing ` .
336
352
@@ -381,7 +397,7 @@ Renames a file path.
381
397
renameDir :: forall a s. (DirName -> DirName) -> Path a Dir s -> Path a Dir s
382
398
```
383
399
384
- Renames a directory path. Note: This is a simple rename of the terminal
400
+ Renames a directory path. Note: This is a simple rename of the terminal
385
401
directory name, not a "move".
386
402
387
403
#### ` canonicalize `
@@ -412,7 +428,7 @@ unsafePrintPath :: forall a b s. Path a b s -> String
412
428
printPath :: forall a b. Path a b Sandboxed -> String
413
429
```
414
430
415
- Prints a ` Path ` into its canonical ` String ` representation. For security
431
+ Prints a ` Path ` into its canonical ` String ` representation. For security
416
432
reasons, the path must be sandboxed before it can be rendered to a string.
417
433
418
434
#### ` printPath' `
@@ -421,8 +437,8 @@ reasons, the path must be sandboxed before it can be rendered to a string.
421
437
printPath' :: forall a b. Escaper -> Path a b Sandboxed -> String
422
438
```
423
439
424
- Prints a ` Path ` into its canonical ` String ` representation, using the
425
- specified escaper to escape special characters in path segments. For
440
+ Prints a ` Path ` into its canonical ` String ` representation, using the
441
+ specified escaper to escape special characters in path segments. For
426
442
security reasons, the path must be sandboxed before rendering to string.
427
443
428
444
#### ` identicalPath `
@@ -431,8 +447,8 @@ security reasons, the path must be sandboxed before rendering to string.
431
447
identicalPath :: forall a a' b b' s s'. Path a b s -> Path a' b' s' -> Boolean
432
448
```
433
449
434
- Determines if two paths have the exact same representation. Note that
435
- two paths may represent the same path even if they have different
450
+ Determines if two paths have the exact same representation. Note that
451
+ two paths may represent the same path even if they have different
436
452
representations!
437
453
438
454
#### ` relativeTo `
@@ -441,19 +457,19 @@ representations!
441
457
relativeTo :: forall a b s s'. Path a b s -> Path a Dir s' -> Maybe (Path Rel b s')
442
458
```
443
459
444
- Makes one path relative to another reference path, if possible, otherwise
445
- returns ` Nothing ` . The returned path inherits the sandbox settings of the
460
+ Makes one path relative to another reference path, if possible, otherwise
461
+ returns ` Nothing ` . The returned path inherits the sandbox settings of the
446
462
reference path.
447
463
448
- Note there are some cases this function cannot handle.
464
+ Note there are some cases this function cannot handle.
449
465
450
466
#### ` sandbox `
451
467
452
468
``` purescript
453
469
sandbox :: forall a b s. Path a Dir Sandboxed -> Path a b s -> Maybe (Path Rel b Sandboxed)
454
470
```
455
471
456
- Attempts to sandbox a path relative to some directory. If successful, the sandboxed
472
+ Attempts to sandbox a path relative to some directory. If successful, the sandboxed
457
473
directory will be returned relative to the sandbox directory (although this can easily
458
474
be converted into an absolute path using ` </> ` ).
459
475
@@ -475,7 +491,7 @@ parsePath :: forall z. (RelFile Unsandboxed -> z) -> (AbsFile Unsandboxed -> z)
475
491
```
476
492
477
493
Parses a canonical ` String ` representation of a path into a ` Path ` value.
478
- Note that in order to be unambiguous, trailing directories should be
494
+ Note that in order to be unambiguous, trailing directories should be
479
495
marked with a trailing slash character (` '/' ` ).
480
496
481
497
#### ` parseRelFile `
@@ -521,4 +537,46 @@ instance showPath :: Show (Path a b s)
521
537
522
538
``` purescript
523
539
instance eqPath :: Eq (Path a b s)
540
+ ```
541
+
542
+
543
+ #### ` showFileName `
544
+
545
+ ``` purescript
546
+ instance showFileName :: Show FileName
547
+ ```
548
+
549
+
550
+ #### ` eqFileName `
551
+
552
+ ``` purescript
553
+ instance eqFileName :: Eq FileName
554
+ ```
555
+
556
+
557
+ #### ` ordFileName `
558
+
559
+ ``` purescript
560
+ instance ordFileName :: Ord FileName
561
+ ```
562
+
563
+
564
+ #### ` showDirName `
565
+
566
+ ``` purescript
567
+ instance showDirName :: Show DirName
568
+ ```
569
+
570
+
571
+ #### ` eqDirName `
572
+
573
+ ``` purescript
574
+ instance eqDirName :: Eq DirName
575
+ ```
576
+
577
+
578
+ #### ` ordDirName `
579
+
580
+ ``` purescript
581
+ instance ordDirName :: Ord DirName
524
582
```
0 commit comments