diff options
author | Eduardo Julian | 2015-09-12 22:36:34 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-09-12 22:36:34 -0400 |
commit | c9560da3760d0d277a715a966496451020f3f2f8 (patch) | |
tree | a0cb370dee25c4e1b919cc8e4ea936823389e59e /source/lux/host | |
parent | 45a102bae3707d1a5220d7e124221ed46882f22d (diff) |
- Added exhaustiveness testing for exception-handling code.
- Added some optimizations for using List & Maybe within the compiler.
Diffstat (limited to '')
-rw-r--r-- | source/lux/host/io.lux | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/lux/host/io.lux b/source/lux/host/io.lux index 4542b0519..99e15722d 100644 --- a/source/lux/host/io.lux +++ b/source/lux/host/io.lux @@ -30,11 +30,11 @@ (let [in (_jvm_getstatic "java.lang.System" "in") reader (_jvm_new "java.io.InputStreamReader" ["java.io.InputStream"] [in]) buff-reader (_jvm_new "java.io.BufferedReader" ["java.io.Reader"] [reader])] - (@io (let [output (: (Either Text <type>) (try <op>))] - (exec (_jvm_invokeinterface "java.io.Closeable" "close" [] buff-reader []) - (case output - (#;Left _) #;None - (#;Right input) (#;Some input)))))))] + (@io (let [output (: (Either Text <type>) (try <op>)) + _close (: (Either Text (,)) (try (_jvm_invokeinterface "java.io.Closeable" "close" [] buff-reader [])))] + (case [output _close] + (\or [(#;Left _) _] [_ (#;Left _)]) #;None + [(#;Right input) (#;Right _)] (#;Some input))))))] [read-char Char (_jvm_i2c (_jvm_invokevirtual "java.io.BufferedReader" "read" [] buff-reader []))] [read-line Text (_jvm_invokevirtual "java.io.BufferedReader" "readLine" [] buff-reader [])] |