Skip to content

Commit

Permalink
New type for Lux (part 3).
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Apr 29, 2024
1 parent 72d2058 commit 11d66cf
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ cd ~/lux/ && find . -name '*.lux' | xargs wc -l | sort -rn

```
cd ~/lux && grep -r "" --include *.lux | sort
cd ~/lux && grep -RiIl 'BEFORE' | xargs sed -i 's/BEFORE/AFTER/g'
```

---

# Clean everything

```
cd ~/lux/lux-bootstrapper/ && lein clean && \
cd ~/lux/lux-jvm/ && lein clean && \
cd ~/lux/stdlib/ && lux clean && \
cd ~/lux/lux-js/ && lux clean && \
Expand Down
19 changes: 1 addition & 18 deletions stdlib/source/library/lux.lux
Original file line number Diff line number Diff line change
Expand Up @@ -684,26 +684,9 @@
(.def# #Eval (tag [{#Some [1 #0 ..mode_tags]} Mode]) .public)
(.def# #Interpreter (tag [{#Some [1 #1 ..mode_tags]} Mode]) .public)

... (every .public Info
... (Record
... [#target Text
... #version Text
... #mode Mode
... #configuration (Stack [Text Text])]))
(.def# Info
(.is# Type
{#Named [..prelude "Info"]
{#Product
... target
Text
{#Product
... version
Text
{#Product
... mode
Mode
... configuration
{#Reification {#Product Text Text} Stack}}}}})
(.type# "info"))
.public)

(.def# info_slots
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/library/lux/compiler/language/lux/analysis.lux
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@

(the .public (info version host configuration)
(-> Version Text Configuration
Info)
@type.Info)
[.#target host
.#version (version.as_text version)
.#mode {.#Build}
.#configuration configuration])

(the .public (state info)
(-> Info
(-> @type.Info
..State)
[@type.#info info
@type.#source ..dummy_source
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/library/lux/compiler/meta/archive.lux
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@
(Projection ..Frozen)
(all <>.and
<binary>.natural
(<binary>.stack (<>.and <binary>.text <binary>.text))
(<binary>.list (<>.and <binary>.text <binary>.text))
<binary>.natural
(<binary>.stack (<>.and <binary>.text <binary>.natural))))

(the as_binary
(Injection ..Frozen)
(all \\injection.and
\\injection.natural
(\\injection.stack (\\injection.and \\injection.text \\injection.text))
(\\injection.list (\\injection.and \\injection.text \\injection.text))
\\injection.natural
(\\injection.stack (\\injection.and \\injection.text \\injection.natural))))

Expand Down
16 changes: 15 additions & 1 deletion stdlib/source/library/lux/compiler/type.lux
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#Bit #Natural #Integer #Revolution #Decimal #Text #Name #Form #Variant #Tuple

Maybe
Info
#target #version #mode #configuration
Lux
#info #source #provenance
#current_module #modules #scopes
Expand Down Expand Up @@ -207,9 +209,20 @@
(<| (template#macro (_ ,it))
[(.Or ..Text ,it)]))

(the Property_List
(<| (template#macro (_ ,it))
[(..List' [..Text ,it])]))

(every .public Info
(Record
[#target ..Text
#version ..Text
#mode .Mode
#configuration (..Property_List ..Text)]))

(every .public Lux
(Record
[#info .Info
[#info ..Info
#source .Source
#provenance ..Provenance
#current_module (Maybe ..Name_Of_Module)
Expand Down Expand Up @@ -316,6 +329,7 @@
["provenance" ..Provenance]
["code" ..Code]
["type" ..Type]
["info" ..Info]
["lux" ..Lux]
["eval" ..Eval'])
(is (property.List ..Type))
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/library/lux/meta.lux
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
["[0]" try (.only Try)]]
[data
[collection
[stack
[list
["[0]" property]]]]]]
[/
["[0]" provenance]])
Expand Down Expand Up @@ -165,7 +165,7 @@

[target [.#info .#target] Text]
[version [.#info .#version] Text]
[configuration [.#info .#configuration] (property.Stack Text)]
[configuration [.#info .#configuration] (property.List Text)]
)

(the .public provenance
Expand Down
28 changes: 12 additions & 16 deletions stdlib/source/library/lux/meta/configuration.lux
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
["<[1]>" \\projection (.only Projection)]]
[collection
["[0]" list (.use "[1]#[0]" functor)
["?[1]" \\projection]]
["[0]" stack (.use "[1]#[0]" functor)
["/" property]]]]
["/" property]
["?[1]" \\projection]]]]
[math
[number (.only hex)]]
[macro
Expand All @@ -35,7 +34,7 @@
["<[1]>" \\projection]]]]])

(every .public Configuration
(/.Stack Text))
(/.List Text))

(the .public equivalence
(Equivalence Configuration)
Expand Down Expand Up @@ -67,8 +66,7 @@

(the .public as_text
(text.Injection Configuration)
(|>> list.of_stack
(list#each (function (_ [feature value])
(|>> (list#each (function (_ [feature value])
(text (..as_text' feature) (..as_text' value))))
text.together))

Expand All @@ -78,25 +76,23 @@
(<| (<>.after (<text>.this ..start))
(<>.before (<text>.this ..end))
(<text>.slice (<text>.some! (<text>.none_of! ..end)))))]
(by <>.functor each list.as_stack
(<>.some (<>.and of_text of_text)))))
(<>.some (<>.and of_text of_text))))

(exception.the .public invalid)

(the configuration
(<code>.Projection Configuration)
(by <>.functor each list.as_stack
(<code>.tuple (<>.some (<>.and <code>.text <code>.text)))))
(<code>.tuple (<>.some (<>.and <code>.text <code>.text))))

(the (< expected actual)
(-> Configuration
(Predicate Configuration))
(stack.every? (function (_ [feature value])
(|> actual
(/.value feature)
(maybe#each (text.= value))
(maybe.else false)))
expected))
(list.every? (function (_ [feature value])
(|> actual
(/.value feature)
(maybe#each (text.= value))
(maybe.else false)))
expected))

(the .public for
(syntax.macro (_ [branches (<>.some (<>.and ..configuration ?list.any))
Expand Down

0 comments on commit 11d66cf

Please sign in to comment.