@@ -37,16 +37,16 @@ import Control.Monad.Eff.Exception (EXCEPTION)
3737import Data.DateTime (DateTime )
3838import Data.Time.Duration (Milliseconds (..))
3939import Data.DateTime.Instant (fromDateTime , unInstant )
40- import Data.Function.Uncurried (Fn1 , Fn5 , Fn3 , Fn2 ,
40+ import Data.Function.Uncurried (Fn1 , Fn5 , Fn3 , Fn2 ,
4141 runFn1 , runFn5 , runFn3 , runFn2 )
4242import Data.Nullable (Nullable (), toNullable )
4343import Data.Int (round )
4444import Data.Maybe (Maybe (..))
4545import Node.Buffer (Buffer (), BUFFER (), size )
4646import Node.Encoding (Encoding )
4747
48- import Node.FS (FS , FileDescriptor , ByteCount , FilePosition , BufferLength ,
49- BufferOffset , FileMode , FileFlags , SymlinkType ,
48+ import Node.FS (FS , FileDescriptor , ByteCount , FilePosition , BufferLength ,
49+ BufferOffset , FileMode , FileFlags , SymlinkType ,
5050 fileFlagsToNode , symlinkTypeToNode )
5151import Node.FS.Stats (StatsObj , Stats (..))
5252import Node.Path (FilePath ())
@@ -83,15 +83,15 @@ fs = unsafeRequireFS
8383-- | Renames a file.
8484rename :: forall eff . FilePath
8585 -> FilePath
86- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
86+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
8787
8888rename oldFile newFile = mkEff $ \_ -> runFn2
8989 fs.renameSync oldFile newFile
9090
9191-- | Truncates a file to the specified length.
9292truncate :: forall eff . FilePath
9393 -> Int
94- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
94+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
9595
9696truncate file len = mkEff $ \_ -> runFn2
9797 fs.truncateSync file len
@@ -100,30 +100,30 @@ truncate file len = mkEff $ \_ -> runFn2
100100chown :: forall eff . FilePath
101101 -> Int
102102 -> Int
103- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
103+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
104104
105105chown file uid gid = mkEff $ \_ -> runFn3
106106 fs.chownSync file uid gid
107107
108108-- | Changes the permissions of a file.
109109chmod :: forall eff . FilePath
110110 -> Perms
111- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
111+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
112112
113113chmod file perms = mkEff $ \_ -> runFn2
114114 fs.chmodSync file (permsToString perms)
115115
116116-- | Gets file statistics.
117117stat :: forall eff . FilePath
118- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Stats
118+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Stats
119119
120120stat file = map Stats $ mkEff $ \_ -> runFn1
121121 fs.statSync file
122122
123123-- | Creates a link to an existing file.
124124link :: forall eff . FilePath
125125 -> FilePath
126- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
126+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
127127
128128link src dst = mkEff $ \_ -> runFn2
129129 fs.linkSync src dst
@@ -132,21 +132,21 @@ link src dst = mkEff $ \_ -> runFn2
132132symlink :: forall eff . FilePath
133133 -> FilePath
134134 -> SymlinkType
135- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
135+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
136136
137137symlink src dst ty = mkEff $ \_ -> runFn3
138138 fs.symlinkSync src dst (symlinkTypeToNode ty)
139139
140140-- | Reads the value of a symlink.
141141readlink :: forall eff . FilePath
142- -> Eff (fs :: FS , err :: EXCEPTION | eff ) FilePath
142+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) FilePath
143143
144144readlink path = mkEff $ \_ -> runFn1
145145 fs.readlinkSync path
146146
147147-- | Find the canonicalized absolute location for a path.
148148realpath :: forall eff . FilePath
149- -> Eff (fs :: FS , err :: EXCEPTION | eff ) FilePath
149+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) FilePath
150150
151151realpath path = mkEff $ \_ -> runFn2
152152 fs.realpathSync path {}
@@ -155,42 +155,42 @@ realpath path = mkEff $ \_ -> runFn2
155155-- | already resolved paths.
156156realpath' :: forall eff cache . FilePath
157157 -> { | cache }
158- -> Eff (fs :: FS , err :: EXCEPTION | eff ) FilePath
158+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) FilePath
159159
160160realpath' path cache = mkEff $ \_ -> runFn2
161161 fs.realpathSync path cache
162162
163163-- | Deletes a file.
164164unlink :: forall eff . FilePath
165- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
165+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
166166
167167unlink file = mkEff $ \_ -> runFn1
168168 fs.unlinkSync file
169169
170170-- | Deletes a directory.
171171rmdir :: forall eff . FilePath
172- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
172+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
173173
174174rmdir file = mkEff $ \_ -> runFn1
175175 fs.rmdirSync file
176176
177177-- | Makes a new directory.
178178mkdir :: forall eff . FilePath
179- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
179+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
180180
181181mkdir = flip mkdir' $ mkPerms all all all
182182
183183-- | Makes a new directory with the specified permissions.
184184mkdir' :: forall eff . FilePath
185185 -> Perms
186- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
186+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
187187
188188mkdir' file perms = mkEff $ \_ -> runFn2
189189 fs.mkdirSync file (permsToString perms)
190190
191191-- | Reads the contents of a directory.
192192readdir :: forall eff . FilePath
193- -> Eff (fs :: FS , err :: EXCEPTION | eff ) (Array FilePath )
193+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) (Array FilePath )
194194
195195readdir file = mkEff $ \_ -> runFn1
196196 fs.readdirSync file
@@ -199,7 +199,7 @@ readdir file = mkEff $ \_ -> runFn1
199199utimes :: forall eff . FilePath
200200 -> DateTime
201201 -> DateTime
202- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
202+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
203203
204204utimes file atime mtime = mkEff $ \_ -> runFn3
205205 fs.utimesSync file
@@ -212,23 +212,23 @@ utimes file atime mtime = mkEff $ \_ -> runFn3
212212
213213-- | Reads the entire contents of a file returning the result as a raw buffer.
214214readFile :: forall eff . FilePath
215- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Buffer
215+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Buffer
216216
217217readFile file = mkEff $ \_ -> runFn2
218218 fs.readFileSync file {}
219219
220220-- | Reads the entire contents of a text file with the specified encoding.
221221readTextFile :: forall eff . Encoding
222222 -> FilePath
223- -> Eff (fs :: FS , err :: EXCEPTION | eff ) String
223+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) String
224224
225225readTextFile encoding file = mkEff $ \_ -> runFn2
226226 fs.readFileSync file { encoding: show encoding }
227227
228228-- | Writes a buffer to a file.
229229writeFile :: forall eff . FilePath
230230 -> Buffer
231- -> Eff (buffer :: BUFFER , fs :: FS , err :: EXCEPTION | eff ) Unit
231+ -> Eff (buffer :: BUFFER , fs :: FS , exception :: EXCEPTION | eff ) Unit
232232
233233writeFile file buff = mkEff $ \_ -> runFn3
234234 fs.writeFileSync file buff {}
@@ -237,15 +237,15 @@ writeFile file buff = mkEff $ \_ -> runFn3
237237writeTextFile :: forall eff . Encoding
238238 -> FilePath
239239 -> String
240- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
240+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
241241
242242writeTextFile encoding file text = mkEff $ \_ -> runFn3
243243 fs.writeFileSync file text { encoding: show encoding }
244244
245245-- | Appends the contents of a buffer to a file.
246246appendFile :: forall eff . FilePath
247247 -> Buffer
248- -> Eff (buffer :: BUFFER , fs :: FS , err :: EXCEPTION | eff ) Unit
248+ -> Eff (buffer :: BUFFER , fs :: FS , exception :: EXCEPTION | eff ) Unit
249249
250250appendFile file buff = mkEff $ \_ -> runFn3
251251 fs.appendFileSync file buff {}
@@ -254,7 +254,7 @@ appendFile file buff = mkEff $ \_ -> runFn3
254254appendTextFile :: forall eff . Encoding
255255 -> FilePath
256256 -> String
257- -> Eff (fs :: FS , err :: EXCEPTION | eff ) Unit
257+ -> Eff (fs :: FS , exception :: EXCEPTION | eff ) Unit
258258
259259appendTextFile encoding file buff = mkEff $ \_ -> runFn3
260260 fs.appendFileSync file buff { encoding: show encoding }
@@ -270,7 +270,7 @@ fdOpen :: forall eff.
270270 FilePath
271271 -> FileFlags
272272 -> Maybe FileMode
273- -> Eff (err :: EXCEPTION , fs :: FS | eff ) FileDescriptor
273+ -> Eff (exception :: EXCEPTION , fs :: FS | eff ) FileDescriptor
274274fdOpen file flags mode = mkEff $ \_ ->
275275 runFn3 fs.openSync file (fileFlagsToNode flags) (toNullable mode)
276276
@@ -282,7 +282,7 @@ fdRead :: forall eff.
282282 -> BufferOffset
283283 -> BufferLength
284284 -> Maybe FilePosition
285- -> Eff (buffer :: BUFFER , err :: EXCEPTION , fs :: FS | eff ) ByteCount
285+ -> Eff (buffer :: BUFFER , exception :: EXCEPTION , fs :: FS | eff ) ByteCount
286286fdRead fd buff off len pos =
287287 mkEff $ \_ -> runFn5 fs.readSync fd buff off len (toNullable pos)
288288
@@ -291,7 +291,7 @@ fdRead fd buff off len pos =
291291fdNext :: forall eff .
292292 FileDescriptor
293293 -> Buffer
294- -> Eff (buffer :: BUFFER , err :: EXCEPTION , fs :: FS | eff ) ByteCount
294+ -> Eff (buffer :: BUFFER , exception :: EXCEPTION , fs :: FS | eff ) ByteCount
295295fdNext fd buff = do
296296 sz <- size buff
297297 fdRead fd buff 0 sz Nothing
@@ -304,7 +304,7 @@ fdWrite :: forall eff.
304304 -> BufferOffset
305305 -> BufferLength
306306 -> Maybe FilePosition
307- -> Eff (buffer :: BUFFER , err :: EXCEPTION , fs :: FS | eff ) ByteCount
307+ -> Eff (buffer :: BUFFER , exception :: EXCEPTION , fs :: FS | eff ) ByteCount
308308fdWrite fd buff off len pos =
309309 mkEff $ \_ -> runFn5 fs.writeSync fd buff off len (toNullable pos)
310310
@@ -313,7 +313,7 @@ fdWrite fd buff off len pos =
313313fdAppend :: forall eff .
314314 FileDescriptor
315315 -> Buffer
316- -> Eff (buffer :: BUFFER , err :: EXCEPTION , fs :: FS | eff ) ByteCount
316+ -> Eff (buffer :: BUFFER , exception :: EXCEPTION , fs :: FS | eff ) ByteCount
317317fdAppend fd buff = do
318318 sz <- size buff
319319 fdWrite fd buff 0 sz Nothing
@@ -322,12 +322,12 @@ fdAppend fd buff = do
322322-- | for details.
323323fdFlush :: forall eff .
324324 FileDescriptor
325- -> Eff (err :: EXCEPTION , fs :: FS | eff ) Unit
325+ -> Eff (exception :: EXCEPTION , fs :: FS | eff ) Unit
326326fdFlush fd = mkEff $ \_ -> runFn1 fs.fsyncSync fd
327327
328328-- | Close a file synchronously. See the [Node documentation](http://nodejs.org/api/fs.html#fs_fs_closesync_fd)
329329-- | for details.
330330fdClose :: forall eff .
331331 FileDescriptor
332- -> Eff (err :: EXCEPTION , fs :: FS | eff ) Unit
332+ -> Eff (exception :: EXCEPTION , fs :: FS | eff ) Unit
333333fdClose fd = mkEff $ \_ -> runFn1 fs.closeSync fd
0 commit comments