From 221cf3ea1bd48a8c678d3447558ea94631114ebc Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 4 Aug 2018 10:05:26 -0400 Subject: Made some adjustments to fit stdlib's compiler infrastructure to new-luxc. --- stdlib/source/lux/world/file.lux | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'stdlib/source/lux/world/file.lux') diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 912c448e9..76f03a835 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -2,8 +2,7 @@ [lux #* [control ["." monad (#+ Monad do)] - ["ex" exception (#+ Exception exception:)] - pipe] + ["ex" exception (#+ Exception exception:)]] [data ["." error (#+ Error)] [text @@ -105,20 +104,19 @@ (`` (for {(~~ (static host.jvm)) (as-is (import: #long java/io/File (new [String]) - (exists [] #io #try boolean) - (mkdirs [] #io #try boolean) - (delete [] #io #try boolean) + (~~ (do-template [] + [( [] #io #try boolean)] + + [exists] [mkdirs] [delete] + [isFile] [isDirectory] + [canRead] [canWrite] [canExecute])) + (length [] #io #try long) (listFiles [] #io #try #? (Array java/io/File)) (getAbsolutePath [] #io #try String) (renameTo [java/io/File] #io #try boolean) - (isFile [] #io #try boolean) - (isDirectory [] #io #try boolean) (lastModified [] #io #try long) (setLastModified [long] #io #try boolean) - (canRead [] #io #try boolean) - (canWrite [] #io #try boolean) - (canExecute [] #io #try boolean) (#static separator String)) (import: java/lang/AutoCloseable @@ -245,8 +243,8 @@ (def: #export (exists? System file) (All [m] (-> (System m) File (m Bit))) - (|> file - (do> (:: System &monad) - [(:: System file?)] - [(if> [(wrap #1)] - [(:: System directory? file)])]))) + (do (:: System &monad) + [??? (:: System file? file)] + (if ??? + (wrap #1) + (:: System directory? file)))) -- cgit v1.2.3