aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/world
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/world/console.lux2
-rw-r--r--stdlib/source/lux/world/db/jdbc.jvm.lux14
-rw-r--r--stdlib/source/lux/world/file.lux10
-rw-r--r--stdlib/source/lux/world/net/http/client.lux3
-rw-r--r--stdlib/source/lux/world/net/tcp.jvm.lux12
-rw-r--r--stdlib/source/lux/world/net/udp.jvm.lux10
-rw-r--r--stdlib/source/lux/world/shell.lux6
7 files changed, 29 insertions, 28 deletions
diff --git a/stdlib/source/lux/world/console.lux b/stdlib/source/lux/world/console.lux
index 0d84ae993..88ddf8a8d 100644
--- a/stdlib/source/lux/world/console.lux
+++ b/stdlib/source/lux/world/console.lux
@@ -93,7 +93,7 @@
(function (_ _)
(|> jvm-input
InputStream::read
- (:: (error.with-error io.monad) map .nat)))))
+ (:: (error.with io.monad) map .nat)))))
(def: can-read-line
(..can-read
diff --git a/stdlib/source/lux/world/db/jdbc.jvm.lux b/stdlib/source/lux/world/db/jdbc.jvm.lux
index cc6dd79c1..d66918206 100644
--- a/stdlib/source/lux/world/db/jdbc.jvm.lux
+++ b/stdlib/source/lux/world/db/jdbc.jvm.lux
@@ -90,7 +90,7 @@
(-> (Statement i) java/sql/Connection
(-> java/sql/PreparedStatement (IO (Error a)))
(IO (Error a))))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[prepared (io.io (java/sql/Connection::prepareStatement (sql.sql (get@ #sql statement))
(java/sql/Statement::RETURN_GENERATED_KEYS)
conn))
@@ -112,7 +112,7 @@
(def: #export (connect creds)
(-> Credentials (IO (Error (DB IO))))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[connection (java/sql/DriverManager::getConnection (get@ #url creds)
(get@ #user creds)
(get@ #password creds))]
@@ -123,7 +123,7 @@
(function (execute statement)
(with-statement statement connection
(function (_ prepared)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[row-count (java/sql/PreparedStatement::executeUpdate prepared)]
(wrap (.nat row-count))))))))
@@ -132,7 +132,7 @@
(function (insert statement)
(with-statement statement connection
(function (_ prepared)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[_ (java/sql/PreparedStatement::executeUpdate prepared)
result-set (io.io (java/sql/Statement::getGeneratedKeys prepared))]
(/output.rows /output.long result-set)))))))
@@ -147,7 +147,7 @@
(function (query [statement output])
(with-statement statement connection
(function (_ prepared)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[result-set (java/sql/PreparedStatement::executeQuery prepared)]
(/output.rows output result-set)))))))
)))))
@@ -157,7 +157,7 @@
(-> Credentials
(-> (DB IO) (IO (Error a)))
(IO (Error a))))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[db (..connect creds)
result (action db)
_ (!.use (:: db close) [])]
@@ -168,7 +168,7 @@
(-> Credentials
(-> (DB Promise) (Promise (Error a)))
(Promise (Error a))))
- (do (error.with-error promise.monad)
+ (do (error.with promise.monad)
[db (promise.future (..connect creds))
result (action (..async db))
_ (promise/wrap (io.run (!.use (:: db close) [])))]
diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux
index 55c8a4f8d..b12b2afe6 100644
--- a/stdlib/source/lux/world/file.lux
+++ b/stdlib/source/lux/world/file.lux
@@ -235,7 +235,7 @@
[(def: <name>
(..can-modify
(function (<name> data)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[stream (FileOutputStream::new (java/io/File::new path) <flag>)
_ (OutputStream::write data stream)
_ (OutputStream::flush stream)]
@@ -248,7 +248,7 @@
(def: content
(..can-query
(function (content _)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[#let [file (java/io/File::new path)]
size (java/io/File::length file)
#let [data (binary.create (.nat size))]
@@ -265,7 +265,7 @@
(|> path
java/io/File::new
java/io/File::length
- (:: (error.with-error io.monad) map .nat)))))
+ (:: (error.with io.monad) map .nat)))))
(def: last-modified
(..can-query
@@ -273,7 +273,7 @@
(|> path
java/io/File::new
(java/io/File::lastModified)
- (:: (error.with-error io.monad) map (|>> duration.from-millis instant.absolute))))))
+ (:: (error.with io.monad) map (|>> duration.from-millis instant.absolute))))))
(def: can-execute?
(..can-query
@@ -320,7 +320,7 @@
[(def: <name>
(..can-query
(function (<name> _)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[?children (java/io/File::listFiles (java/io/File::new path))]
(case ?children
(#.Some children)
diff --git a/stdlib/source/lux/world/net/http/client.lux b/stdlib/source/lux/world/net/http/client.lux
index af48d8a23..f2cafb0e3 100644
--- a/stdlib/source/lux/world/net/http/client.lux
+++ b/stdlib/source/lux/world/net/http/client.lux
@@ -19,6 +19,7 @@
["." // (#+ Data Client)
[// (#+ URL)]])
+## TODO: This is unfinished work. Things like headers and cookies are missing.
(`` (for {(~~ (static host.jvm))
(as-is (import: #long java/lang/String)
@@ -51,7 +52,7 @@
Client
(`` (for {(~~ (static host.jvm))
(promise.future
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[conn (java/net/URL::openConnection (java/net/URL::new url))
#let [conn (:coerce java/net/HttpURLConnection conn)]
_ (java/net/HttpURLConnection::setRequestMethod (case method
diff --git a/stdlib/source/lux/world/net/tcp.jvm.lux b/stdlib/source/lux/world/net/tcp.jvm.lux
index 3b664d9d8..fbdf47720 100644
--- a/stdlib/source/lux/world/net/tcp.jvm.lux
+++ b/stdlib/source/lux/world/net/tcp.jvm.lux
@@ -67,34 +67,34 @@
output (Socket::getOutputStream socket)]
(wrap (: (TCP IO)
(structure (def: (read size)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[#let [data (binary.create size)]
bytes-read (InputStream::read data +0 (.int size) input)]
(wrap [(.nat bytes-read)
data])))
(def: (write data)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[_ (OutputStream::write data +0 (.int (binary.size data))
output)]
(Flushable::flush output)))
(def: (close _)
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[_ (AutoCloseable::close input)
_ (AutoCloseable::close output)]
(AutoCloseable::close socket))))))))
(def: #export (client address port)
(-> //.Address //.Port (IO (Error (TCP IO))))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[socket (Socket::new address (.int port))]
(io.io (tcp socket))))
(def: #export (server port)
(-> //.Port (IO (Error [(Promise Any)
(frp.Channel (TCP IO))])))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[server (ServerSocket::new (.int port))
#let [close-signal (: (Promise Any)
(promise #.None))
@@ -107,7 +107,7 @@
(promise.future
(loop [_ []]
(do io.monad
- [?client (do (error.with-error io.monad)
+ [?client (do (error.with io.monad)
[socket (ServerSocket::accept server)]
(io.io (tcp socket)))]
(case ?client
diff --git a/stdlib/source/lux/world/net/udp.jvm.lux b/stdlib/source/lux/world/net/udp.jvm.lux
index 27363956d..09726c5ae 100644
--- a/stdlib/source/lux/world/net/udp.jvm.lux
+++ b/stdlib/source/lux/world/net/udp.jvm.lux
@@ -73,7 +73,7 @@
(`` (for {(~~ (static host.jvm))
(as-is (def: (resolve address)
(-> //.Address (IO (Error InetAddress)))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[addresses (InetAddress::getAllByName address)]
(: (IO (Error InetAddress))
(case (array.size addresses)
@@ -86,7 +86,7 @@
(structure (def: (read size)
(let [data (binary.create size)
packet (DatagramPacket::new|receive data +0 (.int size))]
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[_ (DatagramSocket::receive packet socket)
#let [bytes-read (.nat (DatagramPacket::getLength packet))]]
(wrap [bytes-read
@@ -95,7 +95,7 @@
data]))))
(def: (write [location data])
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[address (resolve (get@ #//.address location))]
(DatagramSocket::send (DatagramPacket::new|send data +0 (.int (binary.size data)) address (.int (get@ #//.port location)))
socket)))
@@ -106,11 +106,11 @@
(def: #export client
(IO (Error (UDP IO)))
(|> (DatagramSocket::new|client)
- (:: (error.with-error io.monad) map udp)))
+ (:: (error.with io.monad) map udp)))
(def: #export server
(-> //.Port (IO (Error (UDP IO))))
(|>> .int
DatagramSocket::new|server
- (:: (error.with-error io.monad) map udp)))
+ (:: (error.with io.monad) map udp)))
)}))
diff --git a/stdlib/source/lux/world/shell.lux b/stdlib/source/lux/world/shell.lux
index aefdf2b3c..a26d63259 100644
--- a/stdlib/source/lux/world/shell.lux
+++ b/stdlib/source/lux/world/shell.lux
@@ -105,7 +105,7 @@
(def: (process-console process)
(-> java/lang/Process (IO (Error (Console IO))))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[jvm-input (java/lang/Process::getInputStream process)
#let [jvm-input (|> jvm-input
java/io/InputStreamReader::new
@@ -118,7 +118,7 @@
(function (_ _)
(|> jvm-input
java/io/Reader::read
- (:: (error.with-error io.monad) map .nat)))))
+ (:: (error.with io.monad) map .nat)))))
(def: can-read-line
(console.can-read
@@ -150,7 +150,7 @@
(def: #export (execute environment command arguments)
(-> Context Text (List Text) (IO (Error (Console IO))))
(`` (for {(~~ (static host.jvm))
- (do (error.with-error io.monad)
+ (do (error.with io.monad)
[windows? (:: @ map (|>> java/lang/String::toLowerCase ..windows?)
(java/lang/System::getProperty "os.name"))
#let [builder (java/lang/ProcessBuilder::new (arguments-array (list& (sanitize-command windows? command)