aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/ffi.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/ffi.lux')
-rw-r--r--stdlib/source/library/lux/ffi.lux122
1 files changed, 61 insertions, 61 deletions
diff --git a/stdlib/source/library/lux/ffi.lux b/stdlib/source/library/lux/ffi.lux
index 65fb0ea9c..d63363c38 100644
--- a/stdlib/source/library/lux/ffi.lux
+++ b/stdlib/source/library/lux/ffi.lux
@@ -96,7 +96,7 @@
(type: Alias
(Maybe Text))
- (def: alias
+ (def alias
(Parser Alias)
(<>.maybe (<>.after (<code>.this (' "as")) <code>.local)))
@@ -105,7 +105,7 @@
[#optional? Bit
#mandatory Code]))
- (def: optional
+ (def optional
(Parser Optional)
(let [token "?"]
(<| (<>.and (<>.parses? (<code>.this_text token)))
@@ -119,7 +119,7 @@
#anonymous a]))
(with_template [<case> <name>]
- [(def: <case>
+ [(def <case>
(All (_ a) (-> (Parser a) (Parser (Named a))))
(|>> (all <>.and
<name>
@@ -133,18 +133,18 @@
(type: Output
Optional)
- (def: output
+ (def output
(Parser Output)
..optional)
(type: Global
(Named Output))
- (def: variables
+ (def variables
(Parser (List Text))
(<>.else (list) (<code>.tuple (<>.some <code>.local))))
- (def: (generalized $ it)
+ (def (generalized $ it)
(All (_ a)
(-> (-> (List Text) a a)
(-> (Parser a) (Parser a))))
@@ -160,7 +160,7 @@
#io? Bit
#try? Bit]))
- (def: input
+ (def input
(Parser Input)
(all <>.and
(<>#in (list))
@@ -171,7 +171,7 @@
(type: Constructor
(Named Input))
- (def: constructor
+ (def constructor
(Parser Constructor)
(<| <code>.form
(..generalized (has [#anonymous #variables]))
@@ -183,11 +183,11 @@
[#static? Bit
#member a]))
- (def: static!
+ (def static!
(Parser Any)
(<code>.this_text "static"))
- (def: (member it)
+ (def (member it)
(All (_ a)
(-> (Parser a)
(Parser (Member a))))
@@ -201,7 +201,7 @@
(type: Field
(Member (Named Output)))
- (def: field
+ (def field
(Parser Field)
(<| <code>.form
..member
@@ -213,7 +213,7 @@
[#input Input
#output Optional]))
- (def: procedure
+ (def procedure
(Parser (Named Procedure))
(<| (..generalized (has [#anonymous #input #variables]))
..named
@@ -225,7 +225,7 @@
(type: Method
(Member (Named Procedure)))
- (def: method
+ (def method
(Parser Method)
(<| <code>.form
..member
@@ -239,7 +239,7 @@
{#Field Field}
{#Method Method}))))
- (`` (`` (def: sub
+ (`` (`` (def sub
(Parser Sub)
(all <>.or
(~~ (for @.lua (~~ (these))
@@ -249,14 +249,14 @@
..method
))))
- (def: parameters
+ (def parameters
(-> (List Optional) (List Optional))
(|>> list.enumeration
(list#each (.function (_ [idx [optional? type]])
[#optional? optional?
#mandatory (|> idx %.nat code.local)]))))
- (def: (output_type it)
+ (def (output_type it)
(-> Optional Code)
(if (the #optional? it)
(` (.Maybe (~ (the #mandatory it))))
@@ -264,17 +264,17 @@
(`` (with_template [<lux_it> <host_it>
<lux_?> <host_?>]
- [(def: .public (<lux_it> _)
+ [(def .public (<lux_it> _)
(-> Any Nothing)
(as_expected (<host_it>)))
- (def: .public <lux_?>
+ (def .public <lux_?>
(-> Any Bit)
(|>> <host_?>))
(template.with_locals [g!it]
- (these (def: g!it' (' g!it))
- (def: (host_optional it)
+ (these (def g!it' (' g!it))
+ (def (host_optional it)
(-> Optional Code)
(.if (.the #optional? it)
(` (.case (~ (the #mandatory it))
@@ -285,7 +285,7 @@
(<host_it>)))
(the #mandatory it)))
- (def: (lux_optional it output)
+ (def (lux_optional it output)
(-> Optional Code Code)
(` (.let [(~ g!it') (~ output)]
(~ (if (the #optional? it)
@@ -319,7 +319,7 @@
#namespace Namespace
#members (List Sub)]))
- (def: class
+ (def class
(Parser Class)
(all <>.and
(<>.either (<>.and <code>.local
@@ -336,14 +336,14 @@
{#Procedure (Named Procedure)}
{#Global Global}))
- (def: importP
+ (def importP
(Parser Import)
(all <>.or
..class
(<code>.form ..procedure)
(<code>.form (..named ..output))))
- (def: (input_type input :it:)
+ (def (input_type input :it:)
(-> Input Code Code)
(let [:it: (if (the #try? input)
(` (.Either .Text (~ :it:)))
@@ -352,7 +352,7 @@
(` ((~! io.IO) (~ :it:)))
:it:)))
- (def: (input_term input term)
+ (def (input_term input term)
(-> Input Code Code)
(let [term (if (the #try? input)
(` (.try (~ term)))
@@ -361,7 +361,7 @@
(` ((~! io.io) (~ term)))
term)))
- (def: (procedure_definition import! source it)
+ (def (procedure_definition import! source it)
(-> (List Code) Code (Named Procedure) Code)
(let [g!it (|> (the #alias it)
(maybe.else (the #name it))
@@ -377,7 +377,7 @@
parameters
(list#each ..output_type :parameters:))]
- (` (.def: ((~ g!it) (~+ (case g!parameters
+ (` (.def ((~ g!it) (~+ (case g!parameters
{.#End} (list g!it)
_ (list#each (the #mandatory) g!parameters))))
(.All ((~ g!it) (~+ g!variables))
@@ -393,19 +393,19 @@
(` (<apply> (.as_expected (~ source))
[(~+ (list#each ..host_optional g!parameters))]))))))))))
- (def: (namespaced namespace class alias member)
+ (def (namespaced namespace class alias member)
(-> Namespace Text Alias Text Text)
(|> namespace
(text.replaced "[1]" (maybe.else class alias))
(text.replaced "[0]" member)))
- (def: class_separator ".")
+ (def class_separator ".")
- (def: host_path
+ (def host_path
(text.replaced .module_separator ..class_separator))
(for @.js (these)
- (def: (imported class)
+ (def (imported class)
(-> Text Code)
(case (text.all_split_by .module_separator class)
{.#Item head tail}
@@ -419,13 +419,13 @@
{.#End}
(` (<import> (~ (code.text class)))))))
- (def: (global_definition import! it)
+ (def (global_definition import! it)
(-> (List Code) Global Code)
(let [g!name (|> (the #alias it)
(maybe.else (the #name it))
code.local)
:output: (the #anonymous it)]
- (` (.def: (~ g!name)
+ (` (.def (~ g!name)
(~ (..output_type :output:))
(.exec
(~+ import!)
@@ -435,7 +435,7 @@
(for @.lua (these)
@.ruby (these)
- (def: (constructor_definition [class_name class_parameters] alias namespace it)
+ (def (constructor_definition [class_name class_parameters] alias namespace it)
(-> Declaration Alias Namespace Constructor Code)
(let [g!it (|> it
(the #alias)
@@ -449,7 +449,7 @@
g!class_variables (list#each code.local class_parameters)
g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!class_variables)))
:output: [#optional? false #mandatory g!class]]
- (` (.def: ((~ g!it) (~+ (case g!parameters
+ (` (.def ((~ g!it) (~+ (case g!parameters
{.#End} (list g!it)
_ (list#each (the #mandatory) g!parameters))))
(.All ((~ g!it) (~+ g!class_variables) (~+ g!input_variables))
@@ -465,7 +465,7 @@
(~ (..imported class_name))))))
[(~+ (list#each ..host_optional g!parameters))]))))))))))
- (def: (static_field_definition import! [class_name class_parameters] alias namespace it)
+ (def (static_field_definition import! [class_name class_parameters] alias namespace it)
(-> (List Code) Declaration Alias Namespace (Named Output) Code)
(let [field (the #name it)
g!it (|> (the #alias it)
@@ -473,7 +473,7 @@
(..namespaced namespace class_name alias)
code.local)
:field: (the #anonymous it)]
- (` (def: (~ g!it)
+ (` (def (~ g!it)
((~! syntax) ((~ g!it) [])
(.at (~! meta.monad) (~' in)
(.list (`' (.exec
@@ -485,7 +485,7 @@
(` (<get> (~ (code.text field))
(~ (..imported class_name)))))))))))))))))
- (def: (virtual_field_definition [class_name class_parameters] alias namespace it)
+ (def (virtual_field_definition [class_name class_parameters] alias namespace it)
(-> Declaration Alias Namespace (Named Output) Code)
(let [name (the #name it)
g!it (|> (the #alias it)
@@ -496,7 +496,7 @@
:field: (the #anonymous it)
g!variables (list#each code.local class_parameters)
g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!variables)))]
- (` (.def: ((~ g!it) (~ g!it))
+ (` (.def ((~ g!it) (~ g!it))
(.All ((~ g!it) (~+ g!variables))
(.-> (~ g!class)
(~ (..output_type :field:))))
@@ -504,13 +504,13 @@
(~ (<| (lux_optional :field:)
(` (<get> (~ (code.text name)) (~ g!it))))))))))
- (def: (field_definition import! class alias namespace it)
+ (def (field_definition import! class alias namespace it)
(-> (List Code) Declaration Alias Namespace Field Code)
(if (the #static? it)
(..static_field_definition import! class alias namespace (the #member it))
(..virtual_field_definition class alias namespace (the #member it))))
- (def: (static_method_definition import! [class_name class_parameters] alias namespace it)
+ (def (static_method_definition import! [class_name class_parameters] alias namespace it)
(-> (List Code) Declaration Alias Namespace (Named Procedure) Code)
(let [method (the #name it)
name (|> (the #alias it)
@@ -525,7 +525,7 @@
(.as (..Object .Any)
(~ (..imported class_name))))))))))
- (def: (virtual_method_definition [class_name class_parameters] alias namespace it)
+ (def (virtual_method_definition [class_name class_parameters] alias namespace it)
(-> Declaration Alias Namespace (Named Procedure) Code)
(let [method (the #name it)
g!it (|> (the #alias it)
@@ -540,7 +540,7 @@
g!class_variables (list#each code.local class_parameters)
g!class (` ((~ (code.local (maybe.else class_name alias))) (~+ g!class_variables)))
:output: (the #output procedure)]
- (` (.def: ((~ g!it) (~+ (list#each (the #mandatory) g!parameters)) (~ g!it))
+ (` (.def ((~ g!it) (~+ (list#each (the #mandatory) g!parameters)) (~ g!it))
(.All ((~ g!it) (~+ g!class_variables) (~+ g!input_variables))
(.-> (~+ (list#each ..output_type :parameters:))
(~ g!class)
@@ -554,13 +554,13 @@
(~ g!it)
[(~+ (list#each ..host_optional g!parameters))])))))))))
- (def: (method_definition import! class alias namespace it)
+ (def (method_definition import! class alias namespace it)
(-> (List Code) Declaration Alias Namespace Method Code)
(if (the #static? it)
(static_method_definition import! class alias namespace (the #member it))
(virtual_method_definition class alias namespace (the #member it))))
- (def: .public import
+ (def .public import
(syntax (_ [host_module (<>.maybe <code>.text)
it ..importP])
(let [host_module_import! (is (List Code)
@@ -606,7 +606,7 @@
))))
(for @.ruby (these)
- (def: .public function
+ (def .public function
(syntax (_ [[self inputs] (<code>.form
(all <>.and
<code>.local
@@ -622,11 +622,11 @@
(.function ((~ (code.local self)) [(~+ (list#each product.left inputs))])
(~ term)))))))))
- (for @.js (these (def: .public type_of
+ (for @.js (these (def .public type_of
(template (type_of object)
[("js type-of" object)]))
- (def: .public global
+ (def .public global
(syntax (_ [type <code>.any
[head tail] (<code>.tuple (<>.and <code>.local (<>.some <code>.local)))])
(with_symbols [g!_]
@@ -652,7 +652,7 @@
(..global (~ type) [(~ (code.local (%.format head "." next)))
(~+ (list#each code.local tail))]))))))))))))
- (def: !defined?
+ (def !defined?
(template (_ <global>)
[(.case (..global Any <global>)
{.#None}
@@ -662,7 +662,7 @@
.true)]))
(with_template [<name> <global>]
- [(def: .public <name>
+ [(def .public <name>
Bit
(!defined? <global>))]
@@ -670,7 +670,7 @@
[on_nashorn? [java lang Object]]
)
- (def: .public on_node_js?
+ (def .public on_node_js?
Bit
(|> (..global (Object Any) [process])
(maybe#each (|>> []
@@ -682,7 +682,7 @@
... These extensions must be defined this way because importing any of the modules
... normally used when writing extensions would introduce a circular dependency
... because the Archive type depends on Binary, and that module depends on this ffi module.
- (def: extension_name
+ (def extension_name
(syntax (_ [])
(do meta.monad
[module meta.current_module_name
@@ -692,15 +692,15 @@
(with_expansions [<undefined> (..extension_name)
<undefined?> (..extension_name)
<object> (..extension_name)]
- (these (def: extension_analysis
+ (these (def extension_analysis
(template (_ <name> <parameter>)
[{5 #1 [<name> <parameter>]}]))
- (def: text_analysis
+ (def text_analysis
(template (_ <it>)
[{0 #0 {5 #1 <it>}}]))
- (def: analysis
+ (def analysis
(template (_ <name> <bindings> <parser> <inputs> <body>)
[("lux def analysis" <name>
(.function (_ name phase archive inputs)
@@ -714,7 +714,7 @@
{try.#Success <inputs>}
<body>)))))]))
- (def: generation
+ (def generation
(template (_ <name> <bindings> <inputs> <body>)
[("lux def generation" <name>
(.function (_ name phase archive inputs)
@@ -738,7 +738,7 @@
(list)
{try.#Success [state js.undefined]})
- (def: .public undefined
+ (def .public undefined
(template (undefined)
[(.is ..Undefined (<undefined>))]))
@@ -757,7 +757,7 @@
[[state it] (phase archive it state)]
(in [state (js.= js.undefined it)])))
- (def: .public undefined?
+ (def .public undefined?
(template (undefined? <it>)
[(.as .Bit (.is .Any (<undefined?> <it>)))]))
@@ -774,11 +774,11 @@
it)]
(in [state (extension_analysis name (list.reversed output))])))
- (def: text_synthesis
+ (def text_synthesis
(template (_ <it>)
[{0 #0 {2 #1 <it>}}]))
- (def: (pairs it)
+ (def (pairs it)
(All (_ a) (-> (List a) (List [a a])))
(case it
(pattern (list.partial left right tail))
@@ -808,7 +808,7 @@
(pairs (list.partial head_key head_value tail)))]
(in [state (js.object (list.reversed output))])))
- (def: .public object
+ (def .public object
(syntax (_ [it (<>.some <code>.any)])
(in (list (` (.as (..Object .Any)
(<object> (~+ it))))))))