From d9a1d70ec04fd5796276aeb46038654ade4484f9 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 3 Oct 2022 20:14:08 -0400 Subject: Migrating default extensions to the new format [Part 1] --- stdlib/source/library/lux.lux | 2048 +++++++++++++++++++++-------------------- 1 file changed, 1026 insertions(+), 1022 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index e1092f696..94735a065 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1,175 +1,175 @@ -("lux def" dummy_location - ["" 0 0] - #0) +(.def# dummy_location + ["" 0 0] + #0) -("lux def" double_quote - ("lux i64 char" +34) - #0) +(.def# double_quote + ("lux i64 char" +34) + #0) -("lux def" \n - ("lux i64 char" +10) - #0) +(.def# \n + ("lux i64 char" +10) + #0) -("lux def" prelude - "library/lux" - #1) +(.def# prelude + "library/lux" + #1) ... (type .public Any ... (Ex (_ a) a)) -("lux def" Any - ("lux type check type" - {9 #1 - [..prelude "Any"] - {8 #0 - {0 #0} - {4 #0 1}}}) - #1) +(.def# Any + ("lux type check type" + {9 #1 + [..prelude "Any"] + {8 #0 + {0 #0} + {4 #0 1}}}) + #1) ... (type .public Nothing ... (All (_ a) a)) -("lux def" Nothing - ("lux type check type" - {9 #1 - [..prelude "Nothing"] - {7 #0 - {0 #0} - {4 #0 1}}}) - #1) - -("lux def" Bit - ("lux type check type" - {9 #1 - [..prelude "Bit"] - {0 #0 "#Bit" {0 #0}}}) - #1) - -("lux def" I64 - ("lux type check type" - {9 #1 - [..prelude "I64"] - {7 #0 - {0 #0} - {0 #0 "#I64" {0 #1 {4 #0 1} {0 #0}}}}}) - #1) - -("lux def" Nat - ("lux type check type" - {9 #1 - [..prelude "Nat"] - {0 #0 "#I64" {0 #1 {0 #0 "#Nat" {0 #0}} {0 #0}}}}) - #1) - -("lux def" Int - ("lux type check type" - {9 #1 - [..prelude "Int"] - {0 #0 "#I64" {0 #1 {0 #0 "#Int" {0 #0}} {0 #0}}}}) - #1) - -("lux def" Rev - ("lux type check type" - {9 #1 - [..prelude "Rev"] - {0 #0 "#I64" {0 #1 {0 #0 "#Rev" {0 #0}} {0 #0}}}}) - #1) - -("lux def" Frac - ("lux type check type" - {9 #1 - [..prelude "Frac"] - {0 #0 "#Frac" {0 #0}}}) - #1) - -("lux def" Text - ("lux type check type" - {9 #1 - [..prelude "Text"] - {0 #0 "#Text" {0 #0}}}) - #1) - -("lux def" Symbol - ("lux type check type" - {9 #1 - [..prelude "Symbol"] - {2 #0 Text Text}}) - #1) +(.def# Nothing + ("lux type check type" + {9 #1 + [..prelude "Nothing"] + {7 #0 + {0 #0} + {4 #0 1}}}) + #1) + +(.def# Bit + ("lux type check type" + {9 #1 + [..prelude "Bit"] + {0 #0 "#Bit" {0 #0}}}) + #1) + +(.def# I64 + ("lux type check type" + {9 #1 + [..prelude "I64"] + {7 #0 + {0 #0} + {0 #0 "#I64" {0 #1 {4 #0 1} {0 #0}}}}}) + #1) + +(.def# Nat + ("lux type check type" + {9 #1 + [..prelude "Nat"] + {0 #0 "#I64" {0 #1 {0 #0 "#Nat" {0 #0}} {0 #0}}}}) + #1) + +(.def# Int + ("lux type check type" + {9 #1 + [..prelude "Int"] + {0 #0 "#I64" {0 #1 {0 #0 "#Int" {0 #0}} {0 #0}}}}) + #1) + +(.def# Rev + ("lux type check type" + {9 #1 + [..prelude "Rev"] + {0 #0 "#I64" {0 #1 {0 #0 "#Rev" {0 #0}} {0 #0}}}}) + #1) + +(.def# Frac + ("lux type check type" + {9 #1 + [..prelude "Frac"] + {0 #0 "#Frac" {0 #0}}}) + #1) + +(.def# Text + ("lux type check type" + {9 #1 + [..prelude "Text"] + {0 #0 "#Text" {0 #0}}}) + #1) + +(.def# Symbol + ("lux type check type" + {9 #1 + [..prelude "Symbol"] + {2 #0 Text Text}}) + #1) ... (type .public (List a) ... (Variant ... {#End} ... {#Item a (List a)})) -("lux def" List - ("lux type check type" - {9 #1 - [..prelude "List"] - {7 #0 - {0 #0} - {1 #0 - ... End - Any - ... Item - {2 #0 - {4 #0 1} - {9 #0 - {4 #0 1} - {4 #0 0}}}}}}) - #1) +(.def# List + ("lux type check type" + {9 #1 + [..prelude "List"] + {7 #0 + {0 #0} + {1 #0 + ... End + Any + ... Item + {2 #0 + {4 #0 1} + {9 #0 + {4 #0 1} + {4 #0 0}}}}}}) + #1) ... (type .public Tag ... (Primitive "#Tag")) -("lux def" Tag - ("lux type check type" - {9 #1 [..prelude "Tag"] - {0 #0 "#Tag" {0 #0}}}) - #1) +(.def# Tag + ("lux type check type" + {9 #1 [..prelude "Tag"] + {0 #0 "#Tag" {0 #0}}}) + #1) ... (type .public Slot ... (Primitive "#Slot")) -("lux def" Slot - ("lux type check type" - {9 #1 [..prelude "Slot"] - {0 #0 "#Slot" {0 #0}}}) - #1) - -("lux def" Label' - ("lux type check type" - {1 #0 [Any {2 #0 [Nat {2 #0 [Bit {9 #0 Symbol List}]}]}]}) - #0) - -("lux def" list_tags - ("lux type check" - {9 #0 Symbol List} - {0 #1 [[..prelude "#End"] - {0 #1 [[..prelude "#Item"] - {0 #0}]}]}) - #0) -("lux def" #End ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #0 ..list_tags]}) List]) #1) -("lux def" #Item ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #1 ..list_tags]}) List]) #1) +(.def# Slot + ("lux type check type" + {9 #1 [..prelude "Slot"] + {0 #0 "#Slot" {0 #0}}}) + #1) + +(.def# Label' + ("lux type check type" + {1 #0 [Any {2 #0 [Nat {2 #0 [Bit {9 #0 Symbol List}]}]}]}) + #0) + +(.def# list_tags + ("lux type check" + {9 #0 Symbol List} + {0 #1 [[..prelude "#End"] + {0 #1 [[..prelude "#Item"] + {0 #0}]}]}) + #0) +(.def# #End ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #0 ..list_tags]}) List]) #1) +(.def# #Item ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #1 ..list_tags]}) List]) #1) ... (type .public (Maybe a) ... {#None} ... {#Some a}) -("lux def" Maybe - ("lux type check type" - {9 #1 - [..prelude "Maybe"] - {7 #0 - {#End} - {1 #0 - ... None - Any - ... Some - {4 #0 1}}}}) - #1) -("lux def" maybe_tags - ("lux type check" - {9 #0 Symbol List} - {0 #1 [[..prelude "#None"] - {0 #1 [[..prelude "#Some"] - {0 #0}]}]}) - #0) -("lux def" #None ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #0 ..maybe_tags]}) Maybe]) #1) -("lux def" #Some ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #1 ..maybe_tags]}) Maybe]) #1) +(.def# Maybe + ("lux type check type" + {9 #1 + [..prelude "Maybe"] + {7 #0 + {#End} + {1 #0 + ... None + Any + ... Some + {4 #0 1}}}}) + #1) +(.def# maybe_tags + ("lux type check" + {9 #0 Symbol List} + {0 #1 [[..prelude "#None"] + {0 #1 [[..prelude "#Some"] + {0 #0}]}]}) + #0) +(.def# #None ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #0 ..maybe_tags]}) Maybe]) #1) +(.def# #Some ("lux type as" Tag [("lux type check" Label' {0 #1 [0 #1 ..maybe_tags]}) Maybe]) #1) ... (type .public Type ... (Rec Type @@ -185,149 +185,149 @@ ... {#ExQ (List Type) Type} ... {#Apply Type Type} ... {#Named Symbol Type}))) -("lux def" Type - ("lux type check type" - {9 #1 [..prelude "Type"] - ({Type - ({Type_List - ({Type_Pair - {9 #0 - {0 #0 ["" {#End}]} - {7 #0 - {#End} - {1 #0 - ... Primitive - {2 #0 Text Type_List} - {1 #0 - ... Sum - Type_Pair +(.def# Type + ("lux type check type" + {9 #1 [..prelude "Type"] + ({Type + ({Type_List + ({Type_Pair + {9 #0 + {0 #0 ["" {#End}]} + {7 #0 + {#End} {1 #0 - ... Product - Type_Pair + ... Primitive + {2 #0 Text Type_List} {1 #0 - ... Function + ... Sum Type_Pair {1 #0 - ... Parameter - Nat + ... Product + Type_Pair {1 #0 - ... Var - Nat + ... Function + Type_Pair {1 #0 - ... Ex + ... Parameter Nat {1 #0 - ... UnivQ - {2 #0 Type_List Type} + ... Var + Nat {1 #0 - ... ExQ - {2 #0 Type_List Type} + ... Ex + Nat {1 #0 - ... Apply - Type_Pair - ... Named - {2 #0 Symbol Type}}}}}}}}}}}}}} - ("lux type check type" {2 #0 Type Type}))} - ("lux type check type" {9 #0 Type List}))} - ("lux type check type" {9 #0 {0 #0 ["" {#End}]} {4 #0 0}}))}) - #1) - -("lux def" type_tags - ("lux type check" - {9 #0 Symbol List} - {0 #1 [[..prelude "#Primitive"] - {0 #1 [[..prelude "#Sum"] - {0 #1 [[..prelude "#Product"] - {0 #1 [[..prelude "#Function"] - {0 #1 [[..prelude "#Parameter"] - {0 #1 [[..prelude "#Var"] - {0 #1 [[..prelude "#Ex"] - {0 #1 [[..prelude "#UnivQ"] - {0 #1 [[..prelude "#ExQ"] - {0 #1 [[..prelude "#Apply"] - {0 #1 [[..prelude "#Named"] - {0 #0}]}]}]}]}]}]}]}]}]}]}]}) - #0) -("lux def" #Primitive ("lux type as" Tag [("lux type check" Label' {#Some [0 #0 ..type_tags]}) Type]) #1) -("lux def" #Sum ("lux type as" Tag [("lux type check" Label' {#Some [1 #0 ..type_tags]}) Type]) #1) -("lux def" #Product ("lux type as" Tag [("lux type check" Label' {#Some [2 #0 ..type_tags]}) Type]) #1) -("lux def" #Function ("lux type as" Tag [("lux type check" Label' {#Some [3 #0 ..type_tags]}) Type]) #1) -("lux def" #Parameter ("lux type as" Tag [("lux type check" Label' {#Some [4 #0 ..type_tags]}) Type]) #1) -("lux def" #Var ("lux type as" Tag [("lux type check" Label' {#Some [5 #0 ..type_tags]}) Type]) #1) -("lux def" #Ex ("lux type as" Tag [("lux type check" Label' {#Some [6 #0 ..type_tags]}) Type]) #1) -("lux def" #UnivQ ("lux type as" Tag [("lux type check" Label' {#Some [7 #0 ..type_tags]}) Type]) #1) -("lux def" #ExQ ("lux type as" Tag [("lux type check" Label' {#Some [8 #0 ..type_tags]}) Type]) #1) -("lux def" #Apply ("lux type as" Tag [("lux type check" Label' {#Some [9 #0 ..type_tags]}) Type]) #1) -("lux def" #Named ("lux type as" Tag [("lux type check" Label' {#Some [9 #1 ..type_tags]}) Type]) #1) + ... UnivQ + {2 #0 Type_List Type} + {1 #0 + ... ExQ + {2 #0 Type_List Type} + {1 #0 + ... Apply + Type_Pair + ... Named + {2 #0 Symbol Type}}}}}}}}}}}}}} + ("lux type check type" {2 #0 Type Type}))} + ("lux type check type" {9 #0 Type List}))} + ("lux type check type" {9 #0 {0 #0 ["" {#End}]} {4 #0 0}}))}) + #1) + +(.def# type_tags + ("lux type check" + {9 #0 Symbol List} + {0 #1 [[..prelude "#Primitive"] + {0 #1 [[..prelude "#Sum"] + {0 #1 [[..prelude "#Product"] + {0 #1 [[..prelude "#Function"] + {0 #1 [[..prelude "#Parameter"] + {0 #1 [[..prelude "#Var"] + {0 #1 [[..prelude "#Ex"] + {0 #1 [[..prelude "#UnivQ"] + {0 #1 [[..prelude "#ExQ"] + {0 #1 [[..prelude "#Apply"] + {0 #1 [[..prelude "#Named"] + {0 #0}]}]}]}]}]}]}]}]}]}]}]}) + #0) +(.def# #Primitive ("lux type as" Tag [("lux type check" Label' {#Some [0 #0 ..type_tags]}) Type]) #1) +(.def# #Sum ("lux type as" Tag [("lux type check" Label' {#Some [1 #0 ..type_tags]}) Type]) #1) +(.def# #Product ("lux type as" Tag [("lux type check" Label' {#Some [2 #0 ..type_tags]}) Type]) #1) +(.def# #Function ("lux type as" Tag [("lux type check" Label' {#Some [3 #0 ..type_tags]}) Type]) #1) +(.def# #Parameter ("lux type as" Tag [("lux type check" Label' {#Some [4 #0 ..type_tags]}) Type]) #1) +(.def# #Var ("lux type as" Tag [("lux type check" Label' {#Some [5 #0 ..type_tags]}) Type]) #1) +(.def# #Ex ("lux type as" Tag [("lux type check" Label' {#Some [6 #0 ..type_tags]}) Type]) #1) +(.def# #UnivQ ("lux type as" Tag [("lux type check" Label' {#Some [7 #0 ..type_tags]}) Type]) #1) +(.def# #ExQ ("lux type as" Tag [("lux type check" Label' {#Some [8 #0 ..type_tags]}) Type]) #1) +(.def# #Apply ("lux type as" Tag [("lux type check" Label' {#Some [9 #0 ..type_tags]}) Type]) #1) +(.def# #Named ("lux type as" Tag [("lux type check" Label' {#Some [9 #1 ..type_tags]}) Type]) #1) ... (type .public Label ... [(Maybe [Nat Bit (List Symbol)]) Type]) -("lux def" Label - ("lux type check" - Type - {#Named [..prelude "Label"] - {#Product {#Apply {#Product Nat {#Product Bit {#Apply Symbol List}}} Maybe} - Type}}) - #1) - -("lux def" tag - ("lux type check" - {#Function Label Tag} - ([_ it] ("lux type as" Tag it))) - #0) - -("lux def" slot - ("lux type check" - {#Function Label Slot} - ([_ it] ("lux type as" Slot it))) - #0) +(.def# Label + ("lux type check" + Type + {#Named [..prelude "Label"] + {#Product {#Apply {#Product Nat {#Product Bit {#Apply Symbol List}}} Maybe} + Type}}) + #1) + +(.def# tag + ("lux type check" + {#Function Label Tag} + ([_ it] ("lux type as" Tag it))) + #0) + +(.def# slot + ("lux type check" + {#Function Label Slot} + ([_ it] ("lux type as" Slot it))) + #0) ... (type .public Location ... (Record ... [#module Text ... #line Nat ... #column Nat])) -("lux def" Location - ("lux type check" - Type - {#Named [..prelude "Location"] - {#Product Text {#Product Nat Nat}}}) - #1) -("lux def" location_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#module"] - {#Item [..prelude "#line"] - {#Item [..prelude "#column"] - {#End}}}}) - #0) -("lux def" #module (slot [{#Some [0 #0 ..location_slots]} Location]) #1) -("lux def" #line (slot [{#Some [1 #0 ..location_slots]} Location]) #1) -("lux def" #column (slot [{#Some [1 #1 ..location_slots]} Location]) #1) +(.def# Location + ("lux type check" + Type + {#Named [..prelude "Location"] + {#Product Text {#Product Nat Nat}}}) + #1) +(.def# location_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#module"] + {#Item [..prelude "#line"] + {#Item [..prelude "#column"] + {#End}}}}) + #0) +(.def# #module (slot [{#Some [0 #0 ..location_slots]} Location]) #1) +(.def# #line (slot [{#Some [1 #0 ..location_slots]} Location]) #1) +(.def# #column (slot [{#Some [1 #1 ..location_slots]} Location]) #1) ... (type .public (Ann m v) ... (Record ... [#meta m ... #datum v])) -("lux def" Ann - ("lux type check" - Type - {#Named [..prelude "Ann"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Product - {#Parameter 3} - {#Parameter 1}}}}}) - #1) -("lux def" ann_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#meta"] - {#Item [..prelude "#datum"] - {#End}}}) - #0) -("lux def" #meta (slot [{#Some [0 #0 ..ann_slots]} Ann]) #1) -("lux def" #datum (slot [{#Some [0 #1 ..ann_slots]} Ann]) #1) +(.def# Ann + ("lux type check" + Type + {#Named [..prelude "Ann"] + {#UnivQ {#End} + {#UnivQ {#End} + {#Product + {#Parameter 3} + {#Parameter 1}}}}}) + #1) +(.def# ann_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#meta"] + {#Item [..prelude "#datum"] + {#End}}}) + #0) +(.def# #meta (slot [{#Some [0 #0 ..ann_slots]} Ann]) #1) +(.def# #datum (slot [{#Some [0 #1 ..ann_slots]} Ann]) #1) ... (type .public (Code' w) ... (Variant @@ -341,285 +341,285 @@ ... {#Form (List (w (Code' w)))} ... {#Variant (List (w (Code' w)))} ... {#Tuple (List (w (Code' w)))})) -("lux def" Code' - ("lux type check" - Type - {#Named [..prelude "Code'"] - ({Code - ({Code_List - {#UnivQ {#End} - {#Sum - ... Bit - Bit - {#Sum - ... Nat - Nat - {#Sum - ... Int - Int - {#Sum - ... Rev - Rev - {#Sum - ... Frac - Frac - {#Sum - ... Text - Text +(.def# Code' + ("lux type check" + Type + {#Named [..prelude "Code'"] + ({Code + ({Code_List + {#UnivQ {#End} {#Sum - ... Symbol - Symbol + ... Bit + Bit {#Sum - ... Form - Code_List + ... Nat + Nat {#Sum - ... Variant - Code_List - ... Tuple - Code_List - }}}}}}}}} - }} - ("lux type check" - Type - {#Apply Code List}))} - ("lux type check" - Type - {#Apply {#Apply {#Parameter 1} - {#Parameter 0}} - {#Parameter 1}}))}) - #1) -("lux def" code'_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Bit"] - {#Item [..prelude "#Nat"] - {#Item [..prelude "#Int"] - {#Item [..prelude "#Rev"] - {#Item [..prelude "#Frac"] - {#Item [..prelude "#Text"] - {#Item [..prelude "#Symbol"] - {#Item [..prelude "#Form"] - {#Item [..prelude "#Variant"] - {#Item [..prelude "#Tuple"] - {#End}}}}}}}}}}}) - #0) -("lux def" #Bit (tag [{#Some [0 #0 ..code'_tags]} Code']) #1) -("lux def" #Nat (tag [{#Some [1 #0 ..code'_tags]} Code']) #1) -("lux def" #Int (tag [{#Some [2 #0 ..code'_tags]} Code']) #1) -("lux def" #Rev (tag [{#Some [3 #0 ..code'_tags]} Code']) #1) -("lux def" #Frac (tag [{#Some [4 #0 ..code'_tags]} Code']) #1) -("lux def" #Text (tag [{#Some [5 #0 ..code'_tags]} Code']) #1) -("lux def" #Symbol (tag [{#Some [6 #0 ..code'_tags]} Code']) #1) -("lux def" #Form (tag [{#Some [7 #0 ..code'_tags]} Code']) #1) -("lux def" #Variant (tag [{#Some [8 #0 ..code'_tags]} Code']) #1) -("lux def" #Tuple (tag [{#Some [8 #1 ..code'_tags]} Code']) #1) + ... Int + Int + {#Sum + ... Rev + Rev + {#Sum + ... Frac + Frac + {#Sum + ... Text + Text + {#Sum + ... Symbol + Symbol + {#Sum + ... Form + Code_List + {#Sum + ... Variant + Code_List + ... Tuple + Code_List + }}}}}}}}} + }} + ("lux type check" + Type + {#Apply Code List}))} + ("lux type check" + Type + {#Apply {#Apply {#Parameter 1} + {#Parameter 0}} + {#Parameter 1}}))}) + #1) +(.def# code'_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Bit"] + {#Item [..prelude "#Nat"] + {#Item [..prelude "#Int"] + {#Item [..prelude "#Rev"] + {#Item [..prelude "#Frac"] + {#Item [..prelude "#Text"] + {#Item [..prelude "#Symbol"] + {#Item [..prelude "#Form"] + {#Item [..prelude "#Variant"] + {#Item [..prelude "#Tuple"] + {#End}}}}}}}}}}}) + #0) +(.def# #Bit (tag [{#Some [0 #0 ..code'_tags]} Code']) #1) +(.def# #Nat (tag [{#Some [1 #0 ..code'_tags]} Code']) #1) +(.def# #Int (tag [{#Some [2 #0 ..code'_tags]} Code']) #1) +(.def# #Rev (tag [{#Some [3 #0 ..code'_tags]} Code']) #1) +(.def# #Frac (tag [{#Some [4 #0 ..code'_tags]} Code']) #1) +(.def# #Text (tag [{#Some [5 #0 ..code'_tags]} Code']) #1) +(.def# #Symbol (tag [{#Some [6 #0 ..code'_tags]} Code']) #1) +(.def# #Form (tag [{#Some [7 #0 ..code'_tags]} Code']) #1) +(.def# #Variant (tag [{#Some [8 #0 ..code'_tags]} Code']) #1) +(.def# #Tuple (tag [{#Some [8 #1 ..code'_tags]} Code']) #1) ... (type .public Code ... (Ann Location (Code' (Ann Location)))) -("lux def" Code - ("lux type check" - Type - {#Named [..prelude "Code"] - ({w - {#Apply {#Apply w Code'} w}} - ("lux type check" Type {#Apply Location Ann}))}) - #1) - -("lux def" private - #0 - #1) - -("lux def" public - #1 - #1) - -("lux def" local - #0 - #1) - -("lux def" global - #1 - #1) - -("lux def" _ann - ("lux type check" - {#Function {#Apply {#Apply Location Ann} Code'} - Code} - ([_ data] - [dummy_location data])) - #0) - -("lux def" bit$ - ("lux type check" - {#Function Bit Code} - ([_ value] (_ann {#Bit value}))) - #0) - -("lux def" nat$ - ("lux type check" - {#Function Nat Code} - ([_ value] (_ann {#Nat value}))) - #0) - -("lux def" int$ - ("lux type check" - {#Function Int Code} - ([_ value] (_ann {#Int value}))) - #0) - -("lux def" rev$ - ("lux type check" - {#Function Rev Code} - ([_ value] (_ann {#Rev value}))) - #0) - -("lux def" frac$ - ("lux type check" - {#Function Frac Code} - ([_ value] (_ann {#Frac value}))) - #0) - -("lux def" text$ - ("lux type check" - {#Function Text Code} - ([_ text] (_ann {#Text text}))) - #0) - -("lux def" symbol$ - ("lux type check" - {#Function Symbol Code} - ([_ name] (_ann {#Symbol name}))) - #0) - -("lux def" local$ - ("lux type check" - {#Function Text Code} - ([_ name] (_ann {#Symbol ["" name]}))) - #0) - -("lux def" form$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Form tokens}))) - #0) - -("lux def" variant$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Variant tokens}))) - #0) - -("lux def" tuple$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Tuple tokens}))) - #0) +(.def# Code + ("lux type check" + Type + {#Named [..prelude "Code"] + ({w + {#Apply {#Apply w Code'} w}} + ("lux type check" Type {#Apply Location Ann}))}) + #1) + +(.def# private + #0 + #1) + +(.def# public + #1 + #1) + +(.def# local + #0 + #1) + +(.def# global + #1 + #1) + +(.def# _ann + ("lux type check" + {#Function {#Apply {#Apply Location Ann} Code'} + Code} + ([_ data] + [dummy_location data])) + #0) + +(.def# bit$ + ("lux type check" + {#Function Bit Code} + ([_ value] (_ann {#Bit value}))) + #0) + +(.def# nat$ + ("lux type check" + {#Function Nat Code} + ([_ value] (_ann {#Nat value}))) + #0) + +(.def# int$ + ("lux type check" + {#Function Int Code} + ([_ value] (_ann {#Int value}))) + #0) + +(.def# rev$ + ("lux type check" + {#Function Rev Code} + ([_ value] (_ann {#Rev value}))) + #0) + +(.def# frac$ + ("lux type check" + {#Function Frac Code} + ([_ value] (_ann {#Frac value}))) + #0) + +(.def# text$ + ("lux type check" + {#Function Text Code} + ([_ text] (_ann {#Text text}))) + #0) + +(.def# symbol$ + ("lux type check" + {#Function Symbol Code} + ([_ name] (_ann {#Symbol name}))) + #0) + +(.def# local$ + ("lux type check" + {#Function Text Code} + ([_ name] (_ann {#Symbol ["" name]}))) + #0) + +(.def# form$ + ("lux type check" + {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Form tokens}))) + #0) + +(.def# variant$ + ("lux type check" + {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Variant tokens}))) + #0) + +(.def# tuple$ + ("lux type check" + {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Tuple tokens}))) + #0) ... (type .public Definition ... [Bit Type Any]) -("lux def" Definition - ("lux type check" - Type - {#Named [..prelude "Definition"] - {#Product Bit {#Product Type Any}}}) - .public) +(.def# Definition + ("lux type check" + Type + {#Named [..prelude "Definition"] + {#Product Bit {#Product Type Any}}}) + .public) ... (type .public Default ... Definition) -("lux def" Default - ("lux type check" - Type - {#Named [..prelude "Default"] - Definition}) - .public) +(.def# Default + ("lux type check" + Type + {#Named [..prelude "Default"] + Definition}) + .public) ... (type .public Alias ... Symbol) -("lux def" Alias - ("lux type check" - Type - {#Named [..prelude "Alias"] - Symbol}) - .public) +(.def# Alias + ("lux type check" + Type + {#Named [..prelude "Alias"] + Symbol}) + .public) ... (type .public Global ... (Variant ... {#Definition Definition} ... {#Alias Alias} ... {#Default Default})) -("lux def" Global - ("lux type check" - Type - {#Named [..prelude "Global"] - {#Sum Definition - {#Sum Alias - Default}}}) - .public) - -("lux def" global_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Definition"] - {#Item [..prelude "#Alias"] - {#Item [..prelude "#Default"] - {#End}}}}) - #0) -("lux def" #Definition (tag [{#Some [0 #0 ..global_tags]} Global]) .public) -("lux def" #Alias (tag [{#Some [1 #0 ..global_tags]} Global]) .public) -("lux def" #Default (tag [{#Some [1 #1 ..global_tags]} Global]) .public) +(.def# Global + ("lux type check" + Type + {#Named [..prelude "Global"] + {#Sum Definition + {#Sum Alias + Default}}}) + .public) + +(.def# global_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Definition"] + {#Item [..prelude "#Alias"] + {#Item [..prelude "#Default"] + {#End}}}}) + #0) +(.def# #Definition (tag [{#Some [0 #0 ..global_tags]} Global]) .public) +(.def# #Alias (tag [{#Some [1 #0 ..global_tags]} Global]) .public) +(.def# #Default (tag [{#Some [1 #1 ..global_tags]} Global]) .public) ... (type .public (Bindings k v) ... (Record ... [#counter Nat ... #mappings (List [k v])])) -("lux def" Bindings - ("lux type check" - Type - {#Named [..prelude "Bindings"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Product - ... counter - Nat - ... mappings - {#Apply {#Product {#Parameter 3} - {#Parameter 1}} - List}}}}}) - .public) - -("lux def" bindings_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#counter"] - {#Item [..prelude "#mappings"] - {#End}}}) - #0) -("lux def" #counter (slot [{#Some [0 #0 ..bindings_slots]} Bindings]) .public) -("lux def" #mappings (slot [{#Some [0 #1 ..bindings_slots]} Bindings]) .public) +(.def# Bindings + ("lux type check" + Type + {#Named [..prelude "Bindings"] + {#UnivQ {#End} + {#UnivQ {#End} + {#Product + ... counter + Nat + ... mappings + {#Apply {#Product {#Parameter 3} + {#Parameter 1}} + List}}}}}) + .public) + +(.def# bindings_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#counter"] + {#Item [..prelude "#mappings"] + {#End}}}) + #0) +(.def# #counter (slot [{#Some [0 #0 ..bindings_slots]} Bindings]) .public) +(.def# #mappings (slot [{#Some [0 #1 ..bindings_slots]} Bindings]) .public) ... (type .public Ref ... {#Local Nat} ... {#Captured Nat}) -("lux def" Ref - ("lux type check" - Type - {#Named [..prelude "Ref"] - {#Sum - ... Local - Nat - ... Captured - Nat}}) - .public) - -("lux def" ref_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Local"] - {#Item [..prelude "#Captured"] - {#End}}}) - #0) -("lux def" #Local (tag [{#Some [0 #0 ..ref_tags]} Ref]) .public) -("lux def" #Captured (tag [{#Some [0 #1 ..ref_tags]} Ref]) .public) +(.def# Ref + ("lux type check" + Type + {#Named [..prelude "Ref"] + {#Sum + ... Local + Nat + ... Captured + Nat}}) + .public) + +(.def# ref_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Local"] + {#Item [..prelude "#Captured"] + {#End}}}) + #0) +(.def# #Local (tag [{#Some [0 #0 ..ref_tags]} Ref]) .public) +(.def# #Captured (tag [{#Some [0 #1 ..ref_tags]} Ref]) .public) ... TODO: Get rid of both #scope_name & #inner_scopes ... (type .public Scope @@ -628,109 +628,109 @@ ... #inner_scopes Nat ... #locals (Bindings Text [Type Nat]) ... #captured (Bindings Text [Type Ref])])) -("lux def" Scope - ("lux type check" - Type - {#Named [..prelude "Scope"] - {#Product - ... name - {#Apply Text List} - {#Product - ... inner - Nat - {#Product - ... locals - {#Apply {#Product Type Nat} {#Apply Text Bindings}} - ... captured - {#Apply {#Product Type Ref} {#Apply Text Bindings}}}}}}) - .public) - -("lux def" scope_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#scope_name"] - {#Item [..prelude "#inner_scopes"] - {#Item [..prelude "#locals"] - {#Item [..prelude "#captured"] - {#End}}}}}) - #0) -("lux def" #scope_name (slot [{#Some [0 #0 ..scope_slots]} Scope]) .public) -("lux def" #inner_scopes (slot [{#Some [1 #0 ..scope_slots]} Scope]) .public) -("lux def" #locals (slot [{#Some [2 #0 ..scope_slots]} Scope]) .public) -("lux def" #captured (slot [{#Some [2 #1 ..scope_slots]} Scope]) .public) - -("lux def" Code_List - ("lux type check" - Type - {#Apply Code List}) - #0) +(.def# Scope + ("lux type check" + Type + {#Named [..prelude "Scope"] + {#Product + ... name + {#Apply Text List} + {#Product + ... inner + Nat + {#Product + ... locals + {#Apply {#Product Type Nat} {#Apply Text Bindings}} + ... captured + {#Apply {#Product Type Ref} {#Apply Text Bindings}}}}}}) + .public) + +(.def# scope_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#scope_name"] + {#Item [..prelude "#inner_scopes"] + {#Item [..prelude "#locals"] + {#Item [..prelude "#captured"] + {#End}}}}}) + #0) +(.def# #scope_name (slot [{#Some [0 #0 ..scope_slots]} Scope]) .public) +(.def# #inner_scopes (slot [{#Some [1 #0 ..scope_slots]} Scope]) .public) +(.def# #locals (slot [{#Some [2 #0 ..scope_slots]} Scope]) .public) +(.def# #captured (slot [{#Some [2 #1 ..scope_slots]} Scope]) .public) + +(.def# Code_List + ("lux type check" + Type + {#Apply Code List}) + #0) ... (type .public (Either l r) ... (Variant ... {#Left l} ... {#Right r})) -("lux def" Either - ("lux type check" - Type - {#Named [..prelude "Either"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Sum - ... Left - {#Parameter 3} - ... Right - {#Parameter 1}}}}}) - .public) - -("lux def" either_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Left"] - {#Item [..prelude "#Right"] - {#End}}}) - #0) -("lux def" #Left (tag [{#Some [0 #0 ..either_tags]} Either]) .public) -("lux def" #Right (tag [{#Some [0 #1 ..either_tags]} Either]) .public) +(.def# Either + ("lux type check" + Type + {#Named [..prelude "Either"] + {#UnivQ {#End} + {#UnivQ {#End} + {#Sum + ... Left + {#Parameter 3} + ... Right + {#Parameter 1}}}}}) + .public) + +(.def# either_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Left"] + {#Item [..prelude "#Right"] + {#End}}}) + #0) +(.def# #Left (tag [{#Some [0 #0 ..either_tags]} Either]) .public) +(.def# #Right (tag [{#Some [0 #1 ..either_tags]} Either]) .public) ... (type .public Source ... [Location Nat Text]) -("lux def" Source - ("lux type check" - Type - {#Named [..prelude "Source"] - {#Product Location {#Product Nat Text}}}) - .public) +(.def# Source + ("lux type check" + Type + {#Named [..prelude "Source"] + {#Product Location {#Product Nat Text}}}) + .public) ... (type .public Module_State ... (Variant ... #Active ... #Compiled ... #Cached)) -("lux def" Module_State - ("lux type check" - Type - {#Named [..prelude "Module_State"] - {#Sum - ... #Active - Any - {#Sum - ... #Compiled - Any - ... #Cached - Any}}}) - .public) - -("lux def" module_state_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Active"] - {#Item [..prelude "#Compiled"] - {#Item [..prelude "#Cached"] - {#End}}}}) - #0) -("lux def" #Active (tag [{#Some [0 #0 ..module_state_tags]} Module_State]) .public) -("lux def" #Compiled (tag [{#Some [1 #0 ..module_state_tags]} Module_State]) .public) -("lux def" #Cached (tag [{#Some [1 #1 ..module_state_tags]} Module_State]) .public) +(.def# Module_State + ("lux type check" + Type + {#Named [..prelude "Module_State"] + {#Sum + ... #Active + Any + {#Sum + ... #Compiled + Any + ... #Cached + Any}}}) + .public) + +(.def# module_state_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Active"] + {#Item [..prelude "#Compiled"] + {#Item [..prelude "#Cached"] + {#End}}}}) + #0) +(.def# #Active (tag [{#Some [0 #0 ..module_state_tags]} Module_State]) .public) +(.def# #Compiled (tag [{#Some [1 #0 ..module_state_tags]} Module_State]) .public) +(.def# #Cached (tag [{#Some [1 #1 ..module_state_tags]} Module_State]) .public) ... (type .public Module ... (Record @@ -739,103 +739,103 @@ ... #definitions (List [Text Global]) ... #imports (List Text) ... #module_state Module_State])) -("lux def" Module - ("lux type check" - Type - {#Named [..prelude "Module"] - {#Product - ... module_hash - Nat - {#Product - ... module_aliases - {#Apply {#Product Text Text} List} - {#Product - ... definitions - {#Apply {#Product Text Global} List} - {#Product - ... imports - {#Apply Text List} - ... module_state - Module_State - }}}}}) - .public) - -("lux def" module_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#module_hash"] - {#Item [..prelude "#module_aliases"] - {#Item [..prelude "#definitions"] - {#Item [..prelude "#imports"] - {#Item [..prelude "#module_state"] - {#End}}}}}}) - #0) -("lux def" #module_hash (slot [{#Some [0 #0 ..module_slots]} Module]) .public) -("lux def" #module_aliases (slot [{#Some [1 #0 ..module_slots]} Module]) .public) -("lux def" #definitions (slot [{#Some [2 #0 ..module_slots]} Module]) .public) -("lux def" #imports (slot [{#Some [3 #0 ..module_slots]} Module]) .public) -("lux def" #module_state (slot [{#Some [3 #1 ..module_slots]} Module]) .public) +(.def# Module + ("lux type check" + Type + {#Named [..prelude "Module"] + {#Product + ... module_hash + Nat + {#Product + ... module_aliases + {#Apply {#Product Text Text} List} + {#Product + ... definitions + {#Apply {#Product Text Global} List} + {#Product + ... imports + {#Apply Text List} + ... module_state + Module_State + }}}}}) + .public) + +(.def# module_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#module_hash"] + {#Item [..prelude "#module_aliases"] + {#Item [..prelude "#definitions"] + {#Item [..prelude "#imports"] + {#Item [..prelude "#module_state"] + {#End}}}}}}) + #0) +(.def# #module_hash (slot [{#Some [0 #0 ..module_slots]} Module]) .public) +(.def# #module_aliases (slot [{#Some [1 #0 ..module_slots]} Module]) .public) +(.def# #definitions (slot [{#Some [2 #0 ..module_slots]} Module]) .public) +(.def# #imports (slot [{#Some [3 #0 ..module_slots]} Module]) .public) +(.def# #module_state (slot [{#Some [3 #1 ..module_slots]} Module]) .public) ... (type .public Type_Context ... (Record ... [#ex_counter Nat ... #var_counter Nat ... #var_bindings (List [Nat (Maybe Type)])])) -("lux def" Type_Context - ("lux type check" - Type - {#Named [..prelude "Type_Context"] - {#Product ... ex_counter - Nat - {#Product ... var_counter - Nat - ... var_bindings - {#Apply {#Product Nat {#Apply Type Maybe}} - List}}}}) - .public) - -("lux def" type_context_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#ex_counter"] - {#Item [..prelude "#var_counter"] - {#Item [..prelude "#var_bindings"] - {#End}}}}) - #0) -("lux def" #ex_counter (slot [{#Some [0 #0 ..type_context_slots]} Type_Context]) .public) -("lux def" #var_counter (slot [{#Some [1 #0 ..type_context_slots]} Type_Context]) .public) -("lux def" #var_bindings (slot [{#Some [1 #1 ..type_context_slots]} Type_Context]) .public) +(.def# Type_Context + ("lux type check" + Type + {#Named [..prelude "Type_Context"] + {#Product ... ex_counter + Nat + {#Product ... var_counter + Nat + ... var_bindings + {#Apply {#Product Nat {#Apply Type Maybe}} + List}}}}) + .public) + +(.def# type_context_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#ex_counter"] + {#Item [..prelude "#var_counter"] + {#Item [..prelude "#var_bindings"] + {#End}}}}) + #0) +(.def# #ex_counter (slot [{#Some [0 #0 ..type_context_slots]} Type_Context]) .public) +(.def# #var_counter (slot [{#Some [1 #0 ..type_context_slots]} Type_Context]) .public) +(.def# #var_bindings (slot [{#Some [1 #1 ..type_context_slots]} Type_Context]) .public) ... (type .public Mode ... (Variant ... {#Build} ... {#Eval} ... {#Interpreter})) -("lux def" Mode - ("lux type check" - Type - {#Named [..prelude "Mode"] - {#Sum - ... Build - Any - {#Sum - ... Eval - Any - ... Interpreter - Any}}}) - .public) - -("lux def" mode_tags - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#Build"] - {#Item [..prelude "#Eval"] - {#Item [..prelude "#Interpreter"] - {#End}}}}) - #0) -("lux def" #Build (tag [{#Some [0 #0 ..mode_tags]} Mode]) .public) -("lux def" #Eval (tag [{#Some [1 #0 ..mode_tags]} Mode]) .public) -("lux def" #Interpreter (tag [{#Some [1 #1 ..mode_tags]} Mode]) .public) +(.def# Mode + ("lux type check" + Type + {#Named [..prelude "Mode"] + {#Sum + ... Build + Any + {#Sum + ... Eval + Any + ... Interpreter + Any}}}) + .public) + +(.def# mode_tags + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#Build"] + {#Item [..prelude "#Eval"] + {#Item [..prelude "#Interpreter"] + {#End}}}}) + #0) +(.def# #Build (tag [{#Some [0 #0 ..mode_tags]} Mode]) .public) +(.def# #Eval (tag [{#Some [1 #0 ..mode_tags]} Mode]) .public) +(.def# #Interpreter (tag [{#Some [1 #1 ..mode_tags]} Mode]) .public) ... (type .public Info ... (Record @@ -843,36 +843,36 @@ ... #version Text ... #mode Mode ... #configuration (List [Text Text])])) -("lux def" Info - ("lux type check" - Type - {#Named [..prelude "Info"] - {#Product - ... target - Text - {#Product - ... version - Text - {#Product - ... mode - Mode - ... configuration - {#Apply {#Product Text Text} List}}}}}) - .public) - -("lux def" info_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#target"] - {#Item [..prelude "#version"] - {#Item [..prelude "#mode"] - {#Item [..prelude "#configuration"] - {#End}}}}}) - #0) -("lux def" #target (slot [{#Some [0 #0 ..info_slots]} Info]) .public) -("lux def" #version (slot [{#Some [1 #0 ..info_slots]} Info]) .public) -("lux def" #mode (slot [{#Some [2 #0 ..info_slots]} Info]) .public) -("lux def" #configuration (slot [{#Some [2 #1 ..info_slots]} Info]) .public) +(.def# Info + ("lux type check" + Type + {#Named [..prelude "Info"] + {#Product + ... target + Text + {#Product + ... version + Text + {#Product + ... mode + Mode + ... configuration + {#Apply {#Product Text Text} List}}}}}) + .public) + +(.def# info_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#target"] + {#Item [..prelude "#version"] + {#Item [..prelude "#mode"] + {#Item [..prelude "#configuration"] + {#End}}}}}) + #0) +(.def# #target (slot [{#Some [0 #0 ..info_slots]} Info]) .public) +(.def# #version (slot [{#Some [1 #0 ..info_slots]} Info]) .public) +(.def# #mode (slot [{#Some [2 #0 ..info_slots]} Info]) .public) +(.def# #configuration (slot [{#Some [2 #1 ..info_slots]} Info]) .public) ... (type .public Lux ... (Rec Lux @@ -890,297 +890,297 @@ ... #extensions Any ... #eval (-> Type Code (-> Lux (Either Text [Lux Any]))) ... #host Any]))) -("lux def" Lux - ("lux type check" - Type - {#Named [..prelude "Lux"] - ({Lux - {#Apply {0 #0 ["" {#End}]} - {#UnivQ {#End} - {#Product - ... info - Info - {#Product - ... source - Source - {#Product - ... location - Location - {#Product - ... current_module - {#Apply Text Maybe} - {#Product - ... modules - {#Apply {#Product Text Module} List} - {#Product - ... scopes - {#Apply Scope List} +(.def# Lux + ("lux type check" + Type + {#Named [..prelude "Lux"] + ({Lux + {#Apply {0 #0 ["" {#End}]} + {#UnivQ {#End} {#Product - ... type_context - Type_Context + ... info + Info {#Product - ... expected - {#Apply Type Maybe} + ... source + Source {#Product - ... seed - Nat + ... location + Location {#Product - ... scope_type_vars - {#Apply Nat List} + ... current_module + {#Apply Text Maybe} {#Product - ... extensions - Any + ... modules + {#Apply {#Product Text Module} List} {#Product - ... eval - {#Function Type - {#Function Code - {#Function Lux - {#Sum Text {#Product Lux Any}}}}} - ... host - Any}}}}}}}}}}}}}}} - {#Apply {0 #0 ["" {#End}]} {#Parameter 0}})}) - .public) - -("lux def" lux_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#info"] - {#Item [..prelude "#source"] - {#Item [..prelude "#location"] - {#Item [..prelude "#current_module"] - {#Item [..prelude "#modules"] - {#Item [..prelude "#scopes"] - {#Item [..prelude "#type_context"] - {#Item [..prelude "#expected"] - {#Item [..prelude "#seed"] - {#Item [..prelude "#scope_type_vars"] - {#Item [..prelude "#extensions"] - {#Item [..prelude "#eval"] - {#Item [..prelude "#host"] - {#End}}}}}}}}}}}}}}) - #0) -("lux def" #info (slot [{#Some [0 #0 ..lux_slots]} Lux]) .public) -("lux def" #source (slot [{#Some [1 #0 ..lux_slots]} Lux]) .public) -("lux def" #location (slot [{#Some [2 #0 ..lux_slots]} Lux]) .public) -("lux def" #current_module (slot [{#Some [3 #0 ..lux_slots]} Lux]) .public) -("lux def" #modules (slot [{#Some [4 #0 ..lux_slots]} Lux]) .public) -("lux def" #scopes (slot [{#Some [5 #0 ..lux_slots]} Lux]) .public) -("lux def" #type_context (slot [{#Some [6 #0 ..lux_slots]} Lux]) .public) -("lux def" #expected (slot [{#Some [7 #0 ..lux_slots]} Lux]) .public) -("lux def" #seed (slot [{#Some [8 #0 ..lux_slots]} Lux]) .public) -("lux def" #scope_type_vars (slot [{#Some [9 #0 ..lux_slots]} Lux]) .public) -("lux def" #extensions (slot [{#Some [10 #0 ..lux_slots]} Lux]) .public) -("lux def" #eval (slot [{#Some [11 #0 ..lux_slots]} Lux]) .public) -("lux def" #host (slot [{#Some [11 #1 ..lux_slots]} Lux]) .public) + ... scopes + {#Apply Scope List} + {#Product + ... type_context + Type_Context + {#Product + ... expected + {#Apply Type Maybe} + {#Product + ... seed + Nat + {#Product + ... scope_type_vars + {#Apply Nat List} + {#Product + ... extensions + Any + {#Product + ... eval + {#Function Type + {#Function Code + {#Function Lux + {#Sum Text {#Product Lux Any}}}}} + ... host + Any}}}}}}}}}}}}}}} + {#Apply {0 #0 ["" {#End}]} {#Parameter 0}})}) + .public) + +(.def# lux_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#info"] + {#Item [..prelude "#source"] + {#Item [..prelude "#location"] + {#Item [..prelude "#current_module"] + {#Item [..prelude "#modules"] + {#Item [..prelude "#scopes"] + {#Item [..prelude "#type_context"] + {#Item [..prelude "#expected"] + {#Item [..prelude "#seed"] + {#Item [..prelude "#scope_type_vars"] + {#Item [..prelude "#extensions"] + {#Item [..prelude "#eval"] + {#Item [..prelude "#host"] + {#End}}}}}}}}}}}}}}) + #0) +(.def# #info (slot [{#Some [0 #0 ..lux_slots]} Lux]) .public) +(.def# #source (slot [{#Some [1 #0 ..lux_slots]} Lux]) .public) +(.def# #location (slot [{#Some [2 #0 ..lux_slots]} Lux]) .public) +(.def# #current_module (slot [{#Some [3 #0 ..lux_slots]} Lux]) .public) +(.def# #modules (slot [{#Some [4 #0 ..lux_slots]} Lux]) .public) +(.def# #scopes (slot [{#Some [5 #0 ..lux_slots]} Lux]) .public) +(.def# #type_context (slot [{#Some [6 #0 ..lux_slots]} Lux]) .public) +(.def# #expected (slot [{#Some [7 #0 ..lux_slots]} Lux]) .public) +(.def# #seed (slot [{#Some [8 #0 ..lux_slots]} Lux]) .public) +(.def# #scope_type_vars (slot [{#Some [9 #0 ..lux_slots]} Lux]) .public) +(.def# #extensions (slot [{#Some [10 #0 ..lux_slots]} Lux]) .public) +(.def# #eval (slot [{#Some [11 #0 ..lux_slots]} Lux]) .public) +(.def# #host (slot [{#Some [11 #1 ..lux_slots]} Lux]) .public) ... (type .public (Meta a) ... (-> Lux (Either Text [Lux a]))) -("lux def" Meta - ("lux type check" - Type - {#Named [..prelude "Meta"] - {#UnivQ {#End} - {#Function Lux - {#Apply {#Product Lux {#Parameter 1}} - {#Apply Text Either}}}}}) - .public) +(.def# Meta + ("lux type check" + Type + {#Named [..prelude "Meta"] + {#UnivQ {#End} + {#Function Lux + {#Apply {#Product Lux {#Parameter 1}} + {#Apply Text Either}}}}}) + .public) ... (type .public Macro' ... (-> (List Code) (Meta (List Code)))) -("lux def" Macro' - ("lux type check" - Type - {#Named [..prelude "Macro'"] - {#Function Code_List {#Apply Code_List Meta}}}) - .public) +(.def# Macro' + ("lux type check" + Type + {#Named [..prelude "Macro'"] + {#Function Code_List {#Apply Code_List Meta}}}) + .public) ... (type .public Macro ... (Primitive "#Macro")) -("lux def" Macro - ("lux type check" - Type - {#Named [..prelude "Macro"] - {#Primitive "#Macro" {#End}}}) - .public) +(.def# Macro + ("lux type check" + Type + {#Named [..prelude "Macro"] + {#Primitive "#Macro" {#End}}}) + .public) ... Base functions & macros -("lux def" meta#in - ("lux type check" - {#UnivQ {#End} {#Function {#Parameter 1} {#Apply {#Parameter 1} Meta}}} - ([_ val] - ([_ state] - {#Right [state val]}))) - #0) - -("lux def" failure - ("lux type check" - {#UnivQ {#End} {#Function Text {#Apply {#Parameter 1} Meta}}} - ([_ msg] - ([_ state] - {#Left msg}))) - #0) - -("lux def" text#composite - ("lux type check" - {#Function Text {#Function Text Text}} - ([_ x] - ([_ y] - ("lux text concat" x y)))) - #0) - -("lux def" symbol_separator - ("lux type check" - Text - ".") - #0) - -("lux def" symbol#encoded - ("lux type check" - {#Function Symbol Text} - ([_ full_name] - ({[module name] - ({"" name - _ (text#composite module (text#composite ..symbol_separator name))} - module)} - full_name))) - #0) +(.def# meta#in + ("lux type check" + {#UnivQ {#End} {#Function {#Parameter 1} {#Apply {#Parameter 1} Meta}}} + ([_ val] + ([_ state] + {#Right [state val]}))) + #0) + +(.def# failure + ("lux type check" + {#UnivQ {#End} {#Function Text {#Apply {#Parameter 1} Meta}}} + ([_ msg] + ([_ state] + {#Left msg}))) + #0) + +(.def# text#composite + ("lux type check" + {#Function Text {#Function Text Text}} + ([_ x] + ([_ y] + ("lux text concat" x y)))) + #0) + +(.def# symbol_separator + ("lux type check" + Text + ".") + #0) + +(.def# symbol#encoded + ("lux type check" + {#Function Symbol Text} + ([_ full_name] + ({[module name] + ({"" name + _ (text#composite module (text#composite ..symbol_separator name))} + module)} + full_name))) + #0) ... TODO: Allow asking the compiler for the name of the definition ... currently being defined. That name can then be fed into ... 'wrong_syntax_error' for easier maintenance of the error_messages. -("lux def" wrong_syntax_error - ("lux type check" - {#Function Symbol Text} - ([_ it] - (text#composite "Wrong syntax for " (symbol#encoded it)))) - #0) - -("lux def" let'' - ("lux type as" Macro - ("lux type check" Macro' - ([_ tokens] - ({{#Item lhs {#Item rhs {#Item body {#End}}}} - (meta#in {#Item (form$ {#Item (variant$ {#Item lhs {#Item body {#End}}}) - {#Item rhs {#End}}}) - {#End}}) +(.def# wrong_syntax_error + ("lux type check" + {#Function Symbol Text} + ([_ it] + (text#composite "Wrong syntax for " (symbol#encoded it)))) + #0) + +(.def# let'' + ("lux type as" Macro + ("lux type check" Macro' + ([_ tokens] + ({{#Item lhs {#Item rhs {#Item body {#End}}}} + (meta#in {#Item (form$ {#Item (variant$ {#Item lhs {#Item body {#End}}}) + {#Item rhs {#End}}}) + {#End}}) - _ - (failure "Wrong syntax for let''")} - tokens)))) - #0) - -("lux def" function'' - ("lux type as" Macro - ("lux type check" Macro' - ([_ tokens] - ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}} - (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" ""]}) - {#Item arg {#End}}}}) - {#Item ({{#End} - body - - _ - (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) - {#Item (_ann {#Tuple args'}) - {#Item body {#End}}}}})} - args') - {#End}}}}) - {#End}}) - - {#Item [_ {#Symbol ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}}} - (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" self]}) - {#Item arg {#End}}}}) - {#Item ({{#End} - body - - _ - (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) - {#Item (_ann {#Tuple args'}) - {#Item body {#End}}}}})} - args') - {#End}}}}) - {#End}}) + _ + (failure "Wrong syntax for let''")} + tokens)))) + #0) + +(.def# function'' + ("lux type as" Macro + ("lux type check" Macro' + ([_ tokens] + ({{#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}} + (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" ""]}) + {#Item arg {#End}}}}) + {#Item ({{#End} + body - _ - (failure "Wrong syntax for function''")} - tokens)))) - #0) - -("lux def" as_def - ("lux type check" - {#Function Code {#Function Code {#Function Code Code}}} - (function'' [name value export_policy] - (form$ {#Item (text$ "lux def") {#Item name {#Item value {#Item export_policy {#End}}}}}))) - #0) - -("lux def" as_checked - ("lux type check" - {#Function Code {#Function Code Code}} - (function'' [type value] - (form$ {#Item (text$ "lux type check") {#Item type {#Item value {#End}}}}))) - #0) - -("lux def" as_function - ("lux type check" - {#Function Code {#Function {#Apply Code List} {#Function Code Code}}} - (function'' as_function [self inputs output] - ({{#End} - output - - {#Item head tail} - (_ann {#Form {#Item (_ann {#Tuple {#Item self {#Item head {#End}}}}) - {#Item (as_function (_ann {#Symbol ["" ""]}) tail output) - {#End}}}})} - inputs))) - #0) - -("lux def" as_macro - ("lux type check" - {#Function Code Code} - (function'' [expression] - (form$ {#Item (text$ "lux type as") - {#Item (symbol$ [..prelude "Macro"]) - {#Item (form$ {#Item (text$ "lux type check") - {#Item (symbol$ [..prelude "Macro'"]) - {#Item expression - {#End}}}}) - {#End}}}}))) - #0) - -("lux def" def' - ("lux type as" Macro - ("lux type check" Macro' - (function'' [tokens] - ({{#Item [export_policy - {#Item [[_ {#Form {#Item [name args]}}] - {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in {#Item [(as_def name - (as_checked type (as_function name args body)) - export_policy) - {#End}]}) - - {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} - (meta#in {#Item [(as_def name (as_checked type body) - export_policy) - {#End}]}) + _ + (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body {#End}}}}})} + args') + {#End}}}}) + {#End}}) + + {#Item [_ {#Symbol ["" self]}] {#Item [_ {#Tuple {#Item arg args'}}] {#Item body {#End}}}} + (meta#in {#Item (_ann {#Form {#Item (_ann {#Tuple {#Item (_ann {#Symbol ["" self]}) + {#Item arg {#End}}}}) + {#Item ({{#End} + body - _ - (failure "Wrong syntax for def'")} - tokens)))) - #0) - -("lux def" macro - ("lux type as" Macro - ("lux type check" Macro' - (function'' [tokens] - ({{#Item [_ {#Form {#Item name {#Item head tail}}}] {#Item body {#End}}} - (meta#in {#Item (as_macro (as_function name {#Item head tail} body)) - {#End}}) + _ + (_ann {#Form {#Item (_ann {#Symbol [..prelude "function''"]}) + {#Item (_ann {#Tuple args'}) + {#Item body {#End}}}}})} + args') + {#End}}}}) + {#End}}) - _ - (failure (wrong_syntax_error [..prelude "macro"]))} - tokens)))) - #1) + _ + (failure "Wrong syntax for function''")} + tokens)))) + #0) + +(.def# as_def + ("lux type check" + {#Function Code {#Function Code {#Function Code Code}}} + (function'' [name value export_policy] + (form$ {#Item (symbol$ [..prelude "def#"]) {#Item name {#Item value {#Item export_policy {#End}}}}}))) + #0) + +(.def# as_checked + ("lux type check" + {#Function Code {#Function Code Code}} + (function'' [type value] + (form$ {#Item (text$ "lux type check") {#Item type {#Item value {#End}}}}))) + #0) + +(.def# as_function + ("lux type check" + {#Function Code {#Function {#Apply Code List} {#Function Code Code}}} + (function'' as_function [self inputs output] + ({{#End} + output + + {#Item head tail} + (_ann {#Form {#Item (_ann {#Tuple {#Item self {#Item head {#End}}}}) + {#Item (as_function (_ann {#Symbol ["" ""]}) tail output) + {#End}}}})} + inputs))) + #0) + +(.def# as_macro + ("lux type check" + {#Function Code Code} + (function'' [expression] + (form$ {#Item (text$ "lux type as") + {#Item (symbol$ [..prelude "Macro"]) + {#Item (form$ {#Item (text$ "lux type check") + {#Item (symbol$ [..prelude "Macro'"]) + {#Item expression + {#End}}}}) + {#End}}}}))) + #0) + +(.def# def' + ("lux type as" Macro + ("lux type check" Macro' + (function'' [tokens] + ({{#Item [export_policy + {#Item [[_ {#Form {#Item [name args]}}] + {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in {#Item [(as_def name + (as_checked type (as_function name args body)) + export_policy) + {#End}]}) + + {#Item [export_policy {#Item [name {#Item [type {#Item [body {#End}]}]}]}]} + (meta#in {#Item [(as_def name (as_checked type body) + export_policy) + {#End}]}) + + _ + (failure "Wrong syntax for def'")} + tokens)))) + #0) + +(.def# macro + ("lux type as" Macro + ("lux type check" Macro' + (function'' [tokens] + ({{#Item [_ {#Form {#Item name {#Item head tail}}}] {#Item body {#End}}} + (meta#in {#Item (as_macro (as_function name {#Item head tail} body)) + {#End}}) + + _ + (failure (wrong_syntax_error [..prelude "macro"]))} + tokens)))) + #1) (def' .public comment Macro @@ -1739,27 +1739,27 @@ ... #in) ... (is (All (_ a b) (-> (-> a (m b)) (m a) (m b))) ... #then))) -("lux def" Monad - ("lux type check" - Type - {#Named [..prelude "Monad"] - (All (_ !) - (Tuple (All (_ a) - (-> a ($ ! a))) - (All (_ a b) - (-> (-> a ($ ! b)) - (-> ($ ! a) ($ ! b))))))}) - #0) - -("lux def" monad_slots - ("lux type check" - {#Apply Symbol List} - {#Item [..prelude "#in"] - {#Item [..prelude "#then"] - {#End}}}) - #0) -("lux def" #in (slot [{#Some [0 #0 ..monad_slots]} Monad]) .private) -("lux def" #then (slot [{#Some [0 #1 ..monad_slots]} Monad]) .private) +(.def# Monad + ("lux type check" + Type + {#Named [..prelude "Monad"] + (All (_ !) + (Tuple (All (_ a) + (-> a ($ ! a))) + (All (_ a b) + (-> (-> a ($ ! b)) + (-> ($ ! a) ($ ! b))))))}) + #0) + +(.def# monad_slots + ("lux type check" + {#Apply Symbol List} + {#Item [..prelude "#in"] + {#Item [..prelude "#then"] + {#End}}}) + #0) +(.def# #in (slot [{#Some [0 #0 ..monad_slots]} Monad]) .private) +(.def# #then (slot [{#Some [0 #1 ..monad_slots]} Monad]) .private) (def' .private maybe#monad ($ Monad Maybe) @@ -1948,7 +1948,8 @@ (def' .public UnQuote Type - {#Primitive "#Macro/UnQuote" {#End}}) + {#Named [..prelude "UnQuote"] + {#Primitive "#Macro/UnQuote" {#End}}}) (def' .public (unquote it) (-> Macro UnQuote) @@ -1960,7 +1961,8 @@ (def' .public Spliced_UnQuote Type - {#Primitive "#Macro/Spliced_UnQuote" {#End}}) + {#Named [..prelude "Spliced_UnQuote"] + {#Primitive "#Macro/Spliced_UnQuote" {#End}}}) (def' .public (spliced_unquote it) (-> Macro Spliced_UnQuote) @@ -3340,7 +3342,8 @@ (def' .public Pattern Type - {#Primitive "#Macro/Pattern" {#End}}) + {#Named [..prelude "Pattern"] + {#Primitive "#Macro/Pattern" {#End}}}) (def' .public (pattern it) (-> Macro Pattern) @@ -3784,9 +3787,9 @@ {#None} body)] - (meta#in (list (` ("lux def" (, (..local$ name)) - (, body) - (, export_policy)))))) + (meta#in (list (` (.def# (, (..local$ name)) + (, body) + (, export_policy)))))) {#None} (failure (..wrong_syntax_error (symbol ..def)))))) @@ -4097,7 +4100,7 @@ (is (-> Code (Meta (List Code))) (function (_ token) (when token - [_ {#Form (list [_ {#Text "lux def"}] [_ {#Symbol ["" slot_name]}] value export_policy)}] + [_ {#Form (list [_ {#Symbol [..prelude "def#"]}] [_ {#Symbol ["" slot_name]}] value export_policy)}] (when (property#value slot_name tag_mappings) {#Some tag} (in (list tag value)) @@ -4624,7 +4627,7 @@ (def (alias_definition imported_module def) (-> Text Text Code) - (` ("lux def alias" (, (local$ def)) (, (symbol$ [imported_module def]))))) + (` (.alias# (, (local$ def)) (, (symbol$ [imported_module def]))))) (def .public only (macro (_ tokens) @@ -5014,9 +5017,9 @@ (in (list#conjoint decls'))) _ - (in (list (` ("lux def" (, (local$ (..module_alias (list short imported_module) alias))) - (, source+) - #0))))))) + (in (list (` (.def# (, (local$ (..module_alias (list short imported_module) alias))) + (, source+) + #0))))))) (def (implementation_declarations imported_module alias implementation) (-> Text Text Symbol (Meta (List Code))) @@ -5087,7 +5090,7 @@ _ (do meta#monad [g!implementation (..generated_symbol "implementation")] - (in [{#Item (` ("lux def" (, g!implementation) (, it) #0)) pre_defs} + (in [{#Item (` (.def# (, g!implementation) (, it) #0)) pre_defs} {#Item g!implementation implementations}])))) [(list) (list)] implementations)) @@ -5740,7 +5743,7 @@ (function (_ [module_name m_alias =refer]) (refer_code module_name (..maybe#else "" m_alias) =refer))) imports) - =module (` ("lux def module" (, =imports)))] + =module (` (.module# (, =imports)))] g!_ (..generated_symbol "")] (in {#Item =module (for "Python" @@ -5749,7 +5752,7 @@ ... {library/lux/tool/compiler/language/lux/generation.no_buffer_for_saving_code} ... Artifact ID: 0 ... Which only ever happens for the Python compiler. - (list#partial (` ("lux def" (, g!_) [] #0)) + (list#partial (` (.def# (, g!_) [] #0)) =refers) =refers)}))))) @@ -5910,7 +5913,8 @@ [(def .public Type (let [[_ short] (symbol )] - {.#Primitive (text#composite "#" short) (list)}))] + {#Named [..prelude short] + {.#Primitive (text#composite "#Extension/" short) (list)}}))] [Analysis] [Synthesis] -- cgit v1.2.3