diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/source/library/lux/control/concurrency/thread.lux | 4 | ||||
-rw-r--r-- | stdlib/source/library/lux/ffi.lux | 24 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/console.lux | 2 | ||||
-rw-r--r-- | stdlib/source/library/lux/world/file.lux | 8 | ||||
-rw-r--r-- | stdlib/source/test/lux/ffi.js.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/ffi.lua.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/ffi.py.lux | 4 |
7 files changed, 33 insertions, 17 deletions
diff --git a/stdlib/source/library/lux/control/concurrency/thread.lux b/stdlib/source/library/lux/control/concurrency/thread.lux index bfb4dc24f..7a21363b1 100644 --- a/stdlib/source/library/lux/control/concurrency/thread.lux +++ b/stdlib/source/library/lux/control/concurrency/thread.lux @@ -129,12 +129,12 @@ @.jvm <jvm> @.js - (..setTimeout (ffi.function [] (..execute! action)) + (..setTimeout (ffi.function (_ []) Any (..execute! action)) (n.frac milli_seconds)) @.python (do io.monad - [_ (|> (ffi.function [] (..execute! action)) + [_ (|> (ffi.function (_ []) Any (..execute! action)) (threading/Timer::new (|> milli_seconds n.frac (f./ +1,000.0))) threading/Timer::start)] (in []))] diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux index 7a1debe9c..81a569b6e 100644 --- a/stdlib/source/library/lux/ffi.lux +++ b/stdlib/source/library/lux/ffi.lux @@ -11,11 +11,12 @@ ["<>" parser ("[1]#[0]" monad) ["<[0]>" code {"+" Parser}]]] [data + ["[0]" product] ["[0]" text ("[1]#[0]" equivalence) ["%" format]] [collection - ["[0]" list ("[1]#[0]" functor mix)]]] - [macro {"+" with_symbols} + ["[0]" list ("[1]#[0]" monad mix)]]] + ["[0]" macro {"+" with_symbols} [syntax {"+" syntax:}] ["[0]" code] ["[0]" template]] @@ -601,11 +602,20 @@ ))) (for [@.ruby (as_is)] - (template: .public (function <inputs> <output>) - [(.:as ..Function - (`` (<function> (~~ (template.amount <inputs>)) - (.function (_ [<inputs>]) - <output>))))])) + (syntax: .public (function [[self inputs] (<code>.form + ($_ <>.and + <code>.local_symbol + (<code>.tuple (<>.some (<>.and <code>.any <code>.any))))) + type <code>.any + term <code>.any]) + (in (list (` (.<| (.:as ..Function) + (<function> (~ (code.nat (list.size inputs)))) + (.:as (.-> [(~+ (list.repeated (list.size inputs) (` .Any)))] + .Any)) + (.: (.-> [(~+ (list#each product.right inputs))] + (~ type))) + (.function ((~ (code.local_symbol self)) [(~+ (list#each product.left inputs))]) + (~ term)))))))) (for [@.js (as_is (template: .public (type_of object) [("js type-of" object)]) diff --git a/stdlib/source/library/lux/world/console.lux b/stdlib/source/library/lux/world/console.lux index 8fc8dcf69..781a11c29 100644 --- a/stdlib/source/library/lux/world/console.lux +++ b/stdlib/source/library/lux/world/console.lux @@ -154,7 +154,7 @@ (let [[read! write!] (: [(async.Async (Try [])) (async.Resolver (Try []))] (async.async []))] (exec - (Writable_Stream::write it (ffi.function [] (io.run! (write! {try.#Success []}))) + (Writable_Stream::write it (ffi.function (_ []) Any (io.run! (write! {try.#Success []}))) (process::stdout)) read!))) diff --git a/stdlib/source/library/lux/world/file.lux b/stdlib/source/library/lux/world/file.lux index aa1598254..c2e799be8 100644 --- a/stdlib/source/library/lux/world/file.lux +++ b/stdlib/source/library/lux/world/file.lux @@ -352,21 +352,21 @@ (def: (any_callback write!) (-> (async.Resolver (Try Any)) ffi.Function) - (<| (ffi.function [error]) + (<| (ffi.function (_ [error Error]) Any) io.run! write! (if (ffi.null? error) {try.#Success []} - {try.#Failure (Error::toString (:as Error error))}))) + {try.#Failure (Error::toString error)}))) (def: (value_callback write!) (All (_ a) (-> (async.Resolver (Try a)) ffi.Function)) - (<| (ffi.function [error datum]) + (<| (ffi.function (_ [error Error datum Any]) Any) io.run! write! (if (ffi.null? error) {try.#Success (:expected datum)} - {try.#Failure (Error::toString (:as Error error))}))) + {try.#Failure (Error::toString error)}))) (ffi.import: JsPath "[1]::[0]" diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index b697c4b66..2a30d0464 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -101,7 +101,9 @@ "js object null?" not)) (_.cover [/.function] - (|> (/.function [input/0] input/0) + (|> (/.function (_ [input/0 Nat]) + Int + (.int input/0)) "js object null?" not)) (_.cover [/.on_browser? /.on_node_js? /.on_nashorn?] diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 8639e374d..4c0a6aed0 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -50,7 +50,9 @@ )))) (_.cover [/.Function /.function] (exec - (|> (/.function [input/0] input/0) + (|> (/.function (_ [input/0 Nat]) + Int + (.int input/0)) (: /.Function) (: (Ex (_ a) (/.Object a)))) true)) diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux index 911ea1c82..ec8381e92 100644 --- a/stdlib/source/test/lux/ffi.py.lux +++ b/stdlib/source/test/lux/ffi.py.lux @@ -53,7 +53,9 @@ )))) (_.cover [/.Function /.function] (exec - (|> (/.function [input/0] input/0) + (|> (/.function (_ [input/0 Nat]) + Int + (.int input/0)) (: /.Function) (: (Ex (_ a) (/.Object a)))) true)) |