From f11afb9d2dfe2d59b41e8056eb8c4ae65268415f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 9 Apr 2022 00:46:03 -0400 Subject: Re-branded "abstract" types as "primitive" types. --- stdlib/source/test/lux/type.lux | 4 +- stdlib/source/test/lux/type/abstract.lux | 104 ------------------------------ stdlib/source/test/lux/type/primitive.lux | 104 ++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 106 deletions(-) delete mode 100644 stdlib/source/test/lux/type/abstract.lux create mode 100644 stdlib/source/test/lux/type/primitive.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 1577c6a20..d2e0fed2b 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -25,7 +25,7 @@ [\\library ["[0]" / ("[1]#[0]" equivalence)]] ["[0]" / "_" - ["[1][0]" abstract] + ["[1][0]" primitive] ["[1][0]" check] ["[1][0]" dynamic] ["[1][0]" implicit] @@ -252,7 +252,7 @@ (text#= (/.format left) (/.format right)))) )) - /abstract.test + /primitive.test /check.test /dynamic.test /implicit.test diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux deleted file mode 100644 index df08a62ae..000000000 --- a/stdlib/source/test/lux/type/abstract.lux +++ /dev/null @@ -1,104 +0,0 @@ -(.using - [library - [lux "*" - ["_" test {"+" Test}] - ["[0]" meta] - [abstract - [monad {"+" do}]] - [control - ["[0]" try] - ["[0]" exception] - [parser - ["<[0]>" code]]] - [data - ["[0]" text ("[1]#[0]" equivalence)]] - ["[0]" macro - [syntax {"+" syntax:}] - ["[0]" code] - ["[0]" template]] - ["[0]" math - ["[0]" random] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]]) - -(template.with_locals [g!Foo g!Bar] - (these (template [ ] - [(syntax: ( []) - (do meta.monad - [frame ] - (in (list (code.text (the /.#name frame))))))] - - [current /.current] - [specific (/.specific (template.text [g!Foo]))] - ) - - (syntax: (with_no_active_frames [macro .any]) - (function (_ compiler) - (let [verdict (case ((macro.expansion macro) compiler) - {try.#Failure error} - (exception.match? /.no_active_frames error) - - {try.#Success _} - false)] - {try.#Success [compiler (list (code.bit verdict))]}))) - - (with_expansions [no_current! (..with_no_active_frames (..current)) - no_specific! (..with_no_active_frames (..specific))] - (/.abstract: (g!Foo a) - Text - - (/.abstract: (g!Bar a) - Nat - - (def: .public test - Test - (<| (_.covering /._) - (_.for [/.abstract:]) - (do random.monad - [expected_foo (random.lower_case 5) - expected_bar random.nat] - (all _.and - (_.cover [/.abstraction] - (and (exec (is (g!Foo Text) - (/.abstraction g!Foo expected_foo)) - true) - (exec (is (g!Bar Text) - (/.abstraction expected_bar)) - true))) - (_.cover [/.representation] - (and (|> expected_foo - (/.abstraction g!Foo) - (is (g!Foo Bit)) - (/.representation g!Foo) - (text#= expected_foo)) - (|> (/.abstraction expected_bar) - (is (g!Bar Bit)) - /.representation - (n.= expected_bar)))) - (_.cover [/.transmutation] - (and (exec (|> expected_foo - (/.abstraction g!Foo) - (is (g!Foo .Macro)) - (/.transmutation g!Foo) - (is (g!Foo .Lux))) - true) - (exec (|> (/.abstraction expected_bar) - (is (g!Bar .Macro)) - /.transmutation - (is (g!Bar .Lux))) - true))) - (_.for [/.Frame] - (all _.and - (_.cover [/.current] - (text#= (template.text [g!Bar]) - (..current))) - (_.cover [/.specific] - (text#= (template.text [g!Foo]) - (..specific))) - (_.cover [/.no_active_frames] - (and no_current! - no_specific!)) - )) - ))))))))) diff --git a/stdlib/source/test/lux/type/primitive.lux b/stdlib/source/test/lux/type/primitive.lux new file mode 100644 index 000000000..5b4a3fe06 --- /dev/null +++ b/stdlib/source/test/lux/type/primitive.lux @@ -0,0 +1,104 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + ["[0]" meta] + [abstract + [monad {"+" do}]] + [control + ["[0]" try] + ["[0]" exception] + [parser + ["<[0]>" code]]] + [data + ["[0]" text ("[1]#[0]" equivalence)]] + ["[0]" macro + [syntax {"+" syntax:}] + ["[0]" code] + ["[0]" template]] + ["[0]" math + ["[0]" random] + [number + ["n" nat]]]]] + [\\library + ["[0]" /]]) + +(template.with_locals [g!Foo g!Bar] + (these (template [ ] + [(syntax: ( []) + (do meta.monad + [frame ] + (in (list (code.text (the /.#name frame))))))] + + [current /.current] + [specific (/.specific (template.text [g!Foo]))] + ) + + (syntax: (with_no_active_frames [macro .any]) + (function (_ compiler) + (let [verdict (case ((macro.expansion macro) compiler) + {try.#Failure error} + (exception.match? /.no_active_frames error) + + {try.#Success _} + false)] + {try.#Success [compiler (list (code.bit verdict))]}))) + + (with_expansions [no_current! (..with_no_active_frames (..current)) + no_specific! (..with_no_active_frames (..specific))] + (/.primitive: (g!Foo a) + Text + + (/.primitive: (g!Bar a) + Nat + + (def: .public test + Test + (<| (_.covering /._) + (_.for [/.primitive:]) + (do random.monad + [expected_foo (random.lower_case 5) + expected_bar random.nat] + (all _.and + (_.cover [/.abstraction] + (and (exec (is (g!Foo Text) + (/.abstraction g!Foo expected_foo)) + true) + (exec (is (g!Bar Text) + (/.abstraction expected_bar)) + true))) + (_.cover [/.representation] + (and (|> expected_foo + (/.abstraction g!Foo) + (is (g!Foo Bit)) + (/.representation g!Foo) + (text#= expected_foo)) + (|> (/.abstraction expected_bar) + (is (g!Bar Bit)) + /.representation + (n.= expected_bar)))) + (_.cover [/.transmutation] + (and (exec (|> expected_foo + (/.abstraction g!Foo) + (is (g!Foo .Macro)) + (/.transmutation g!Foo) + (is (g!Foo .Lux))) + true) + (exec (|> (/.abstraction expected_bar) + (is (g!Bar .Macro)) + /.transmutation + (is (g!Bar .Lux))) + true))) + (_.for [/.Frame] + (all _.and + (_.cover [/.current] + (text#= (template.text [g!Bar]) + (..current))) + (_.cover [/.specific] + (text#= (template.text [g!Foo]) + (..specific))) + (_.cover [/.no_active_frames] + (and no_current! + no_specific!)) + )) + ))))))))) -- cgit v1.2.3