aboutsummaryrefslogtreecommitdiff
path: root/licentia/source/program
diff options
context:
space:
mode:
authorEduardo Julian2021-09-03 21:51:30 -0400
committerEduardo Julian2021-09-03 21:51:30 -0400
commit891b1cfc82322f8017f0a4f6b707d6fe52024545 (patch)
tree957429c0a2ad850b3570492deabe054fb2ace63e /licentia/source/program
parente76add6e6f904677f5c09bb2a66dce283f1b848a (diff)
Unified tuple and record syntax.
Diffstat (limited to 'licentia/source/program')
-rw-r--r--licentia/source/program/licentia/document.lux5
-rw-r--r--licentia/source/program/licentia/input.lux6
-rw-r--r--licentia/source/program/licentia/license.lux82
-rw-r--r--licentia/source/program/licentia/license/addendum.lux4
-rw-r--r--licentia/source/program/licentia/license/copyright.lux5
-rw-r--r--licentia/source/program/licentia/license/definition.lux9
-rw-r--r--licentia/source/program/licentia/license/time.lux5
-rw-r--r--licentia/source/program/licentia/output.lux48
8 files changed, 90 insertions, 74 deletions
diff --git a/licentia/source/program/licentia/document.lux b/licentia/source/program/licentia/document.lux
index 7b159b8f5..07a4e2b83 100644
--- a/licentia/source/program/licentia/document.lux
+++ b/licentia/source/program/licentia/document.lux
@@ -40,8 +40,9 @@
)
(type: .public Section
- {#title Text
- #content Text})
+ (Record
+ [#title Text
+ #content Text]))
(def: .public (section value)
(-> Section Text)
diff --git a/licentia/source/program/licentia/input.lux b/licentia/source/program/licentia/input.lux
index ede659fcf..f6a438e7f 100644
--- a/licentia/source/program/licentia/input.lux
+++ b/licentia/source/program/licentia/input.lux
@@ -67,8 +67,8 @@
(do <>.monad
[start (<json>.field "start" ..amount)
end (<json>.field "end" ..amount)
- #let [period {#time.start start
- #time.end end}]
+ #let [period [#time.start start
+ #time.end end]]
_ (<>.assert (exception.construct ..invalid_period [period])
(n.<= end start))]
(wrap period))))
@@ -163,6 +163,6 @@
(<json>.field "extension" ..extension)
(<json>.field "black-lists" (<json>.array (<>.some ..black_list)))
(<json>.field "attribution" (<json>.nullable ..attribution))
- (<>.default {#//.commons_clause? false}
+ (<>.default [#//.commons_clause? false]
(<json>.field "addendum" ..addendum))
)))
diff --git a/licentia/source/program/licentia/license.lux b/licentia/source/program/licentia/license.lux
index 9060915a3..052ad1f05 100644
--- a/licentia/source/program/licentia/license.lux
+++ b/licentia/source/program/licentia/license.lux
@@ -6,58 +6,70 @@
["#." copyright]])
(type: .public Identification
- {#name Text
- #version Text})
+ (Record
+ [#name Text
+ #version Text]))
(type: .public Termination
- {#patent_retaliation? Bit
- #termination_period Days
- #grace_period Days})
+ (Record
+ [#patent_retaliation? Bit
+ #termination_period Days
+ #grace_period Days]))
(type: .public Liability
- {#can_accept? Bit
- #disclaim_high_risk? Bit})
+ (Record
+ [#can_accept? Bit
+ #disclaim_high_risk? Bit]))
(type: .public Distribution
- {#can_re_license? Bit
- #can_multi_license? Bit})
+ (Record
+ [#can_re_license? Bit
+ #can_multi_license? Bit]))
(type: .public Commercial
- {#can_sell? Bit
- #require_contributor_credit? Bit
- #allow_contributor_endorsement? Bit})
+ (Record
+ [#can_sell? Bit
+ #require_contributor_credit? Bit
+ #allow_contributor_endorsement? Bit]))
(type: .public Extension
- {#same_license? Bit
- #must_be_distinguishable? Bit
- #notification_period (Maybe (Period Months))
- #must_describe_modifications? Bit})
+ (Record
+ [#same_license? Bit
+ #must_be_distinguishable? Bit
+ #notification_period (Maybe (Period Months))
+ #must_describe_modifications? Bit]))
-(type: .public Entity Text)
+(type: .public Entity
+ Text)
(type: .public Black_List
- {#justification (Maybe Text)
- #entities (List Entity)})
+ (Record
+ [#justification (Maybe Text)
+ #entities (List Entity)]))
-(type: .public URL Text)
+(type: .public URL
+ Text)
(type: .public Attribution
- {#copyright_notice Text
- #phrase (Maybe Text)
- #url URL
- #image (Maybe URL)})
+ (Record
+ [#copyright_notice Text
+ #phrase (Maybe Text)
+ #url URL
+ #image (Maybe URL)]))
(type: .public Addendum
- {#commons_clause? Bit})
+ (Record
+ [#commons_clause? Bit]))
(type: .public License
- {#copyright_holders (List /copyright.Holder)
- #identification (Maybe Identification)
- #termination Termination
- #liability Liability
- #distribution Distribution
- #commercial Commercial
- #extension Extension
- #black_lists (List Black_List)
- #attribution (Maybe Attribution)
- #addendum Addendum})
+ (Record
+ [#copyright_holders (List /copyright.Holder)
+ #identification (Maybe Identification)
+ #termination Termination
+ #liability Liability
+ #distribution Distribution
+ #commercial Commercial
+ #extension Extension
+ #black_lists (List Black_List)
+ #attribution (Maybe Attribution)
+ #addendum Addendum]))
diff --git a/licentia/source/program/licentia/license/addendum.lux b/licentia/source/program/licentia/license/addendum.lux
index a3518f68e..1fffda746 100644
--- a/licentia/source/program/licentia/license/addendum.lux
+++ b/licentia/source/program/licentia/license/addendum.lux
@@ -19,8 +19,8 @@
(-> Addendum Text)
(`` (format (~~ (template [<title> <condition> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
["“Commons Clause” License Condition v1.0"
diff --git a/licentia/source/program/licentia/license/copyright.lux b/licentia/source/program/licentia/license/copyright.lux
index 7c2d838c1..3d48653b6 100644
--- a/licentia/source/program/licentia/license/copyright.lux
+++ b/licentia/source/program/licentia/license/copyright.lux
@@ -5,5 +5,6 @@
[time (#+ Year Period)]])
(type: .public Holder
- {#name Text
- #period (Period Year)})
+ (Record
+ [#name Text
+ #period (Period Year)]))
diff --git a/licentia/source/program/licentia/license/definition.lux b/licentia/source/program/licentia/license/definition.lux
index 81be7ffc6..0765a488f 100644
--- a/licentia/source/program/licentia/license/definition.lux
+++ b/licentia/source/program/licentia/license/definition.lux
@@ -8,8 +8,9 @@
["$" document]])
(type: .public Definition
- {#term Text
- #meaning Text})
+ (Record
+ [#term Text
+ #meaning Text]))
(def: not_a_contribution_notice
(format text.double_quote "Not a Contribution" text.double_quote))
@@ -47,8 +48,8 @@
(template [<name> <term> <meaning>]
[(def: .public <name>
Definition
- {#term <term>
- #meaning <meaning>})]
+ [#term <term>
+ #meaning <meaning>])]
[license "This License"
($.paragraph (list (format "the terms and conditions defined in this document")))]
diff --git a/licentia/source/program/licentia/license/time.lux b/licentia/source/program/licentia/license/time.lux
index de6d613b7..e19f7ef16 100644
--- a/licentia/source/program/licentia/license/time.lux
+++ b/licentia/source/program/licentia/license/time.lux
@@ -12,5 +12,6 @@
Nat)
(type: .public (Period a)
- {#start a
- #end a})
+ (Record
+ [#start a
+ #end a]))
diff --git a/licentia/source/program/licentia/output.lux b/licentia/source/program/licentia/output.lux
index c4dd78214..03380ece9 100644
--- a/licentia/source/program/licentia/output.lux
+++ b/licentia/source/program/licentia/output.lux
@@ -48,8 +48,8 @@
(def: .public (grant termination)
(-> Termination Text)
(`` (format (~~ (template [<title> <content>]
- [($.block ($.section {#$.title <title>
- #$.content <content>}))]
+ [($.block ($.section [#$.title <title>
+ #$.content <content>]))]
["Grant of Copyright License"
grant.copyright]
@@ -70,8 +70,8 @@
(def: .public limitation
Text
(`` (format (~~ (template [<title> <content>]
- [($.block ($.section {#$.title <title>
- #$.content <content>}))]
+ [($.block ($.section [#$.title <title>
+ #$.content <content>]))]
["Limitations on Grant Scope"
limitation.grant]
@@ -85,8 +85,8 @@
(def: .public assurance
Text
(`` (format (~~ (template [<title> <content>]
- [($.block ($.section {#$.title <title>
- #$.content <content>}))]
+ [($.block ($.section [#$.title <title>
+ #$.content <content>]))]
["Representation"
assurance.representation]
@@ -98,8 +98,8 @@
(-> Liability Text)
(`` (format (~~ (template [<title> <condition> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
["Disclaimer of Warranty"
@@ -126,8 +126,8 @@
(-> Distribution Text)
(`` (format (~~ (template [<title> <condition> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
[(format "Distribution of a " _.source_code_form)
@@ -147,8 +147,8 @@
(-> Commercial Text)
(`` (format (~~ (template [<title> <condition> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
["Non-Commerciality"
@@ -174,8 +174,8 @@
[false ""])]
(`` (format (~~ (template [<condition> <title> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
[(value@ #license.same_license? value) "License Retention"
@@ -216,8 +216,8 @@
(-> Bit Text)
(`` (format (~~ (template [<title> <condition> <content>]
[(if <condition>
- ($.block ($.section {#$.title <title>
- #$.content <content>}))
+ ($.block ($.section [#$.title <title>
+ #$.content <content>]))
"")]
["Entire Agreement"
@@ -271,25 +271,25 @@
""
black_lists
- ($.block ($.section {#$.title (format "Denial of " _.license)
+ ($.block ($.section [#$.title (format "Denial of " _.license)
#$.content (|> black_lists
(list\each black_list.black_list)
- (text.interposed ..black_list_spacing))})))
+ (text.interposed ..black_list_spacing))])))
- ($.section {#$.title "Definitions"
+ ($.section [#$.title "Definitions"
#$.content (|> definition.all
(list\each (|>> ..definition $.block))
- (text.interposed ""))})
+ (text.interposed ""))])
- ($.block ($.section {#$.title (format "Acceptance of " _.license)
- #$.content limitation.acceptance}))
+ ($.block ($.section [#$.title (format "Acceptance of " _.license)
+ #$.content limitation.acceptance]))
(..grant (value@ #license.termination value))
..limitation
..assurance
- ($.block ($.section {#$.title (format _.submission " of " ($.plural _.contribution))
- #$.content submission.contribution}))
+ ($.block ($.section [#$.title (format _.submission " of " ($.plural _.contribution))
+ #$.content submission.contribution]))
(..liability (value@ #license.liability value))
(..distribution (value@ #license.distribution value))