Skip to content

Commit 1180fa1

Browse files
committed
Updates for 0.7.0
Also, remove Semigroup instance for Perm, and replace it with Semiring.
1 parent 1c2faaf commit 1180fa1

File tree

12 files changed

+719
-91
lines changed

12 files changed

+719
-91
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"purescript-maybe": "~0.3.0",
2323
"purescript-foreign": "~0.5.0",
2424
"purescript-node-buffer": "~0.1.0",
25-
"purescript-node-path": "~0.3.0",
25+
"purescript-node-path": "~0.4.0-rc.1",
2626
"purescript-datetime": "~0.6.0",
2727
"purescript-exceptions": "~0.3.0",
2828
"purescript-strings": "~0.5.0",

docs/Node/FS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Module Node.FS
2+
3+
#### `FS`
4+
5+
``` purescript
6+
data FS :: !
7+
```
8+
9+
#### `SymlinkType`
10+
11+
``` purescript
12+
data SymlinkType
13+
= FileLink
14+
| DirLink
15+
| JunctionLink
16+
```
17+
18+
##### Instances
19+
``` purescript
20+
instance showSymlinkType :: Show SymlinkType
21+
instance eqSymlinkType :: Eq SymlinkType
22+
```
23+
24+

docs/Node/FS/Async.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
## Module Node.FS.Async
2+
3+
#### `Callback`
4+
5+
``` purescript
6+
type Callback eff a = Either Error a -> Eff (fs :: FS | eff) Unit
7+
```
8+
9+
#### `rename`
10+
11+
``` purescript
12+
rename :: forall eff. FilePath -> FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
13+
```
14+
15+
#### `truncate`
16+
17+
``` purescript
18+
truncate :: forall eff. FilePath -> Number -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
19+
```
20+
21+
#### `chown`
22+
23+
``` purescript
24+
chown :: forall eff. FilePath -> Number -> Number -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
25+
```
26+
27+
#### `chmod`
28+
29+
``` purescript
30+
chmod :: forall eff. FilePath -> Perms -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
31+
```
32+
33+
#### `stat`
34+
35+
``` purescript
36+
stat :: forall eff. FilePath -> Callback eff Stats -> Eff (fs :: FS | eff) Unit
37+
```
38+
39+
#### `link`
40+
41+
``` purescript
42+
link :: forall eff. FilePath -> FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
43+
```
44+
45+
#### `symlink`
46+
47+
``` purescript
48+
symlink :: forall eff. FilePath -> FilePath -> SymlinkType -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
49+
```
50+
51+
#### `readlink`
52+
53+
``` purescript
54+
readlink :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
55+
```
56+
57+
#### `realpath`
58+
59+
``` purescript
60+
realpath :: forall eff. FilePath -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
61+
```
62+
63+
#### `realpath'`
64+
65+
``` purescript
66+
realpath' :: forall eff cache. FilePath -> { | cache } -> Callback eff FilePath -> Eff (fs :: FS | eff) Unit
67+
```
68+
69+
#### `unlink`
70+
71+
``` purescript
72+
unlink :: forall eff. FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
73+
```
74+
75+
#### `rmdir`
76+
77+
``` purescript
78+
rmdir :: forall eff. FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
79+
```
80+
81+
#### `mkdir`
82+
83+
``` purescript
84+
mkdir :: forall eff. FilePath -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
85+
```
86+
87+
#### `mkdir'`
88+
89+
``` purescript
90+
mkdir' :: forall eff. FilePath -> Perms -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
91+
```
92+
93+
#### `readdir`
94+
95+
``` purescript
96+
readdir :: forall eff. FilePath -> Callback eff (Array FilePath) -> Eff (fs :: FS | eff) Unit
97+
```
98+
99+
#### `utimes`
100+
101+
``` purescript
102+
utimes :: forall eff. FilePath -> Date -> Date -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
103+
```
104+
105+
#### `readFile`
106+
107+
``` purescript
108+
readFile :: forall eff. FilePath -> Callback eff Buffer -> Eff (fs :: FS | eff) Unit
109+
```
110+
111+
#### `readTextFile`
112+
113+
``` purescript
114+
readTextFile :: forall eff. Encoding -> FilePath -> Callback eff String -> Eff (fs :: FS | eff) Unit
115+
```
116+
117+
#### `writeFile`
118+
119+
``` purescript
120+
writeFile :: forall eff. FilePath -> Buffer -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
121+
```
122+
123+
#### `writeTextFile`
124+
125+
``` purescript
126+
writeTextFile :: forall eff. Encoding -> FilePath -> String -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
127+
```
128+
129+
#### `appendFile`
130+
131+
``` purescript
132+
appendFile :: forall eff. FilePath -> Buffer -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
133+
```
134+
135+
#### `appendTextFile`
136+
137+
``` purescript
138+
appendTextFile :: forall eff. Encoding -> FilePath -> String -> Callback eff Unit -> Eff (fs :: FS | eff) Unit
139+
```
140+
141+
#### `exists`
142+
143+
``` purescript
144+
exists :: forall eff. FilePath -> (Boolean -> Eff eff Unit) -> Eff (fs :: FS | eff) Unit
145+
```
146+
147+

docs/Node/FS/Perms.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
## Module Node.FS.Perms
2+
3+
#### `Perm`
4+
5+
``` purescript
6+
newtype Perm
7+
```
8+
9+
A `Perm` value specifies what is allowed to be done with a particular
10+
file by a particular class of user — that is, whether it is
11+
readable, writable, and/or executable. It has a `Semiring` instance, which
12+
allows you to combine permissions:
13+
14+
- `(+)` adds `Perm` values together. For example, `read + write` means
15+
"readable and writable".
16+
- `(*)` masks permissions. It can be thought of as selecting only the
17+
permissions that two `Perm` values have in common. For example: `(read
18+
+ write) * (write + execute) == write`.
19+
20+
21+
22+
##### Instances
23+
``` purescript
24+
instance eqPerm :: Eq Perm
25+
instance ordPerm :: Ord Perm
26+
instance showPerm :: Show Perm
27+
instance semiringPerm :: Semiring Perm
28+
```
29+
30+
#### `none`
31+
32+
``` purescript
33+
none :: Perm
34+
```
35+
36+
No permissions. This is the identity of the `Semiring` operation `(+)`
37+
for `Perm`; that is, it is the same as `zero`.
38+
39+
#### `read`
40+
41+
``` purescript
42+
read :: Perm
43+
```
44+
45+
The "readable" permission.
46+
47+
#### `write`
48+
49+
``` purescript
50+
write :: Perm
51+
```
52+
53+
The "writable" permission.
54+
55+
#### `execute`
56+
57+
``` purescript
58+
execute :: Perm
59+
```
60+
61+
The "executable" permission.
62+
63+
#### `all`
64+
65+
``` purescript
66+
all :: Perm
67+
```
68+
69+
All permissions: readable, writable, and executable. This is the identity
70+
of the `Semiring` operation `(*)` for `Perm`; that is, it is the same as
71+
`one`.
72+
73+
#### `Perms`
74+
75+
``` purescript
76+
newtype Perms
77+
```
78+
79+
A `Perms` value includes all the permissions information about a
80+
particular file or directory, by storing a `Perm` value for each of the
81+
file owner, the group, and any other users.
82+
83+
##### Instances
84+
``` purescript
85+
instance eqPerms :: Eq Perms
86+
instance ordPerms :: Ord Perms
87+
instance showPerms :: Show Perms
88+
```
89+
90+
#### `permsFromString`
91+
92+
``` purescript
93+
permsFromString :: String -> Maybe Perms
94+
```
95+
96+
Attempt to parse a `Perms` value from a `String` containing an octal
97+
integer. For example,
98+
`permsFromString "0644" == Just (mkPerms (read + write) read read)`.
99+
100+
#### `mkPerms`
101+
102+
``` purescript
103+
mkPerms :: Perm -> Perm -> Perm -> Perms
104+
```
105+
106+
Create a `Perms` value. The arguments represent the owner's, group's, and
107+
other users' permission sets, respectively.
108+
109+
#### `permsToString`
110+
111+
``` purescript
112+
permsToString :: Perms -> String
113+
```
114+
115+
Convert a `Perms` value to an octal string, in a format similar to that
116+
accepted by `chmod`. For example:
117+
`permsToString (mkPerms (read + write) read read) == "0644"`
118+
119+
#### `permsToInt`
120+
121+
``` purescript
122+
permsToInt :: Perms -> Int
123+
```
124+
125+
Convert a `Perms` value to an `Int`, via `permsToString`.
126+
127+

docs/Node/FS/Stats.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
## Module Node.FS.Stats
2+
3+
#### `StatsObj`
4+
5+
``` purescript
6+
type StatsObj = { dev :: Number, mode :: Number, nlink :: Number, uid :: Number, gid :: Number, rdev :: Number, ino :: Number, size :: Number, atime :: JSDate, mtime :: JSDate, ctime :: JSDate, isFile :: Fn0 Boolean, isDirectory :: Fn0 Boolean, isBlockDevice :: Fn0 Boolean, isCharacterDevice :: Fn0 Boolean, isFIFO :: Fn0 Boolean, isSocket :: Fn0 Boolean }
7+
```
8+
9+
#### `Stats`
10+
11+
``` purescript
12+
data Stats
13+
= Stats StatsObj
14+
```
15+
16+
##### Instances
17+
``` purescript
18+
instance showStats :: Show Stats
19+
```
20+
21+
#### `isFile`
22+
23+
``` purescript
24+
isFile :: Stats -> Boolean
25+
```
26+
27+
#### `isDirectory`
28+
29+
``` purescript
30+
isDirectory :: Stats -> Boolean
31+
```
32+
33+
#### `isBlockDevice`
34+
35+
``` purescript
36+
isBlockDevice :: Stats -> Boolean
37+
```
38+
39+
#### `isCharacterDevice`
40+
41+
``` purescript
42+
isCharacterDevice :: Stats -> Boolean
43+
```
44+
45+
#### `isFIFO`
46+
47+
``` purescript
48+
isFIFO :: Stats -> Boolean
49+
```
50+
51+
#### `isSocket`
52+
53+
``` purescript
54+
isSocket :: Stats -> Boolean
55+
```
56+
57+
#### `isSymbolicLink`
58+
59+
``` purescript
60+
isSymbolicLink :: Stats -> Boolean
61+
```
62+
63+
#### `accessedTime`
64+
65+
``` purescript
66+
accessedTime :: Stats -> Date
67+
```
68+
69+
#### `modifiedTime`
70+
71+
``` purescript
72+
modifiedTime :: Stats -> Date
73+
```
74+
75+
#### `statusChangedTime`
76+
77+
``` purescript
78+
statusChangedTime :: Stats -> Date
79+
```
80+
81+

0 commit comments

Comments
 (0)