From 820ffc0a87d7960e62508fc451d9df7a94a6afa7 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 19 Oct 2022 19:34:33 -0400 Subject: Migrating default extensions to the new format [Part 2] --- stdlib/source/library/lux.lux | 1637 +++++++++++++++++++---------------------- 1 file changed, 773 insertions(+), 864 deletions(-) (limited to 'stdlib/source/library/lux.lux') diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 94735a065..af8942f2e 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -3,11 +3,11 @@ #0) (.def# double_quote - ("lux i64 char" +34) + (.int_char# +34) #0) (.def# \n - ("lux i64 char" +10) + (.int_char# +10) #0) (.def# prelude @@ -17,7 +17,7 @@ ... (type .public Any ... (Ex (_ a) a)) (.def# Any - ("lux type check type" + (.is_type# {9 #1 [..prelude "Any"] {8 #0 @@ -28,7 +28,7 @@ ... (type .public Nothing ... (All (_ a) a)) (.def# Nothing - ("lux type check type" + (.is_type# {9 #1 [..prelude "Nothing"] {7 #0 @@ -37,14 +37,14 @@ #1) (.def# Bit - ("lux type check type" + (.is_type# {9 #1 [..prelude "Bit"] {0 #0 "#Bit" {0 #0}}}) #1) (.def# I64 - ("lux type check type" + (.is_type# {9 #1 [..prelude "I64"] {7 #0 @@ -53,42 +53,42 @@ #1) (.def# Nat - ("lux type check type" + (.is_type# {9 #1 [..prelude "Nat"] {0 #0 "#I64" {0 #1 {0 #0 "#Nat" {0 #0}} {0 #0}}}}) #1) (.def# Int - ("lux type check type" + (.is_type# {9 #1 [..prelude "Int"] {0 #0 "#I64" {0 #1 {0 #0 "#Int" {0 #0}} {0 #0}}}}) #1) (.def# Rev - ("lux type check type" + (.is_type# {9 #1 [..prelude "Rev"] {0 #0 "#I64" {0 #1 {0 #0 "#Rev" {0 #0}} {0 #0}}}}) #1) (.def# Frac - ("lux type check type" + (.is_type# {9 #1 [..prelude "Frac"] {0 #0 "#Frac" {0 #0}}}) #1) (.def# Text - ("lux type check type" + (.is_type# {9 #1 [..prelude "Text"] {0 #0 "#Text" {0 #0}}}) #1) (.def# Symbol - ("lux type check type" + (.is_type# {9 #1 [..prelude "Symbol"] {2 #0 Text Text}}) @@ -99,7 +99,7 @@ ... {#End} ... {#Item a (List a)})) (.def# List - ("lux type check type" + (.is_type# {9 #1 [..prelude "List"] {7 #0 @@ -118,7 +118,7 @@ ... (type .public Tag ... (Primitive "#Tag")) (.def# Tag - ("lux type check type" + (.is_type# {9 #1 [..prelude "Tag"] {0 #0 "#Tag" {0 #0}}}) #1) @@ -126,31 +126,30 @@ ... (type .public Slot ... (Primitive "#Slot")) (.def# Slot - ("lux type check type" + (.is_type# {9 #1 [..prelude "Slot"] {0 #0 "#Slot" {0 #0}}}) #1) (.def# Label' - ("lux type check type" + (.is_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}]}]}) + (.is# {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) +(.def# #End (.as# Tag [(.is# Label' {0 #1 [0 #0 ..list_tags]}) List]) #1) +(.def# #Item (.as# Tag [(.is# Label' {0 #1 [0 #1 ..list_tags]}) List]) #1) ... (type .public (Maybe a) ... {#None} ... {#Some a}) (.def# Maybe - ("lux type check type" + (.is_type# {9 #1 [..prelude "Maybe"] {7 #0 @@ -162,14 +161,13 @@ {4 #0 1}}}}) #1) (.def# maybe_tags - ("lux type check" - {9 #0 Symbol List} - {0 #1 [[..prelude "#None"] - {0 #1 [[..prelude "#Some"] - {0 #0}]}]}) + (.is# {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) +(.def# #None (.as# Tag [(.is# Label' {0 #1 [0 #0 ..maybe_tags]}) Maybe]) #1) +(.def# #Some (.as# Tag [(.is# Label' {0 #1 [0 #1 ..maybe_tags]}) Maybe]) #1) ... (type .public Type ... (Rec Type @@ -186,7 +184,7 @@ ... {#Apply Type Type} ... {#Named Symbol Type}))) (.def# Type - ("lux type check type" + (.is_type# {9 #1 [..prelude "Type"] ({Type ({Type_List @@ -227,59 +225,55 @@ 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}}))}) + (.is_type# {2 #0 Type Type}))} + (.is_type# {9 #0 Type List}))} + (.is_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}]}]}]}]}]}]}]}]}]}]}]}) + (.is# {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) +(.def# #Primitive (.as# Tag [(.is# Label' {#Some [0 #0 ..type_tags]}) Type]) #1) +(.def# #Sum (.as# Tag [(.is# Label' {#Some [1 #0 ..type_tags]}) Type]) #1) +(.def# #Product (.as# Tag [(.is# Label' {#Some [2 #0 ..type_tags]}) Type]) #1) +(.def# #Function (.as# Tag [(.is# Label' {#Some [3 #0 ..type_tags]}) Type]) #1) +(.def# #Parameter (.as# Tag [(.is# Label' {#Some [4 #0 ..type_tags]}) Type]) #1) +(.def# #Var (.as# Tag [(.is# Label' {#Some [5 #0 ..type_tags]}) Type]) #1) +(.def# #Ex (.as# Tag [(.is# Label' {#Some [6 #0 ..type_tags]}) Type]) #1) +(.def# #UnivQ (.as# Tag [(.is# Label' {#Some [7 #0 ..type_tags]}) Type]) #1) +(.def# #ExQ (.as# Tag [(.is# Label' {#Some [8 #0 ..type_tags]}) Type]) #1) +(.def# #Apply (.as# Tag [(.is# Label' {#Some [9 #0 ..type_tags]}) Type]) #1) +(.def# #Named (.as# Tag [(.is# Label' {#Some [9 #1 ..type_tags]}) Type]) #1) ... (type .public Label ... [(Maybe [Nat Bit (List Symbol)]) Type]) (.def# Label - ("lux type check" - Type - {#Named [..prelude "Label"] - {#Product {#Apply {#Product Nat {#Product Bit {#Apply Symbol List}}} Maybe} - Type}}) + (.is# 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))) + (.is# {#Function Label Tag} + ([_ it] (.as# Tag it))) #0) (.def# slot - ("lux type check" - {#Function Label Slot} - ([_ it] ("lux type as" Slot it))) + (.is# {#Function Label Slot} + ([_ it] (.as# Slot it))) #0) ... (type .public Location @@ -288,18 +282,16 @@ ... #line Nat ... #column Nat])) (.def# Location - ("lux type check" - Type - {#Named [..prelude "Location"] - {#Product Text {#Product Nat Nat}}}) + (.is# 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}}}}) + (.is# {#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) @@ -310,21 +302,19 @@ ... [#meta m ... #datum v])) (.def# Ann - ("lux type check" - Type - {#Named [..prelude "Ann"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Product - {#Parameter 3} - {#Parameter 1}}}}}) + (.is# 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}}}) + (.is# {#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) @@ -342,66 +332,62 @@ ... {#Variant (List (w (Code' w)))} ... {#Tuple (List (w (Code' w)))})) (.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 + (.is# Type + {#Named [..prelude "Code'"] + ({Code + ({Code_List + {#UnivQ {#End} {#Sum - ... Text - Text + ... Bit + Bit {#Sum - ... Symbol - Symbol + ... Nat + Nat {#Sum - ... Form - Code_List + ... Int + Int {#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}}))}) + ... Rev + Rev + {#Sum + ... Frac + Frac + {#Sum + ... Text + Text + {#Sum + ... Symbol + Symbol + {#Sum + ... Form + Code_List + {#Sum + ... Variant + Code_List + ... Tuple + Code_List + }}}}}}}}} + }} + (.is# Type + {#Apply Code List}))} + (.is# 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}}}}}}}}}}}) + (.is# {#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) @@ -417,12 +403,11 @@ ... (type .public Code ... (Ann Location (Code' (Ann Location)))) (.def# Code - ("lux type check" - Type - {#Named [..prelude "Code"] - ({w - {#Apply {#Apply w Code'} w}} - ("lux type check" Type {#Apply Location Ann}))}) + (.is# Type + {#Named [..prelude "Code"] + ({w + {#Apply {#Apply w Code'} w}} + (.is# Type {#Apply Location Ann}))}) #1) (.def# private @@ -442,104 +427,89 @@ #1) (.def# _ann - ("lux type check" - {#Function {#Apply {#Apply Location Ann} Code'} - Code} - ([_ data] - [dummy_location data])) + (.is# {#Function {#Apply {#Apply Location Ann} Code'} + Code} + ([_ data] + [dummy_location data])) #0) (.def# bit$ - ("lux type check" - {#Function Bit Code} - ([_ value] (_ann {#Bit value}))) + (.is# {#Function Bit Code} + ([_ value] (_ann {#Bit value}))) #0) (.def# nat$ - ("lux type check" - {#Function Nat Code} - ([_ value] (_ann {#Nat value}))) + (.is# {#Function Nat Code} + ([_ value] (_ann {#Nat value}))) #0) (.def# int$ - ("lux type check" - {#Function Int Code} - ([_ value] (_ann {#Int value}))) + (.is# {#Function Int Code} + ([_ value] (_ann {#Int value}))) #0) (.def# rev$ - ("lux type check" - {#Function Rev Code} - ([_ value] (_ann {#Rev value}))) + (.is# {#Function Rev Code} + ([_ value] (_ann {#Rev value}))) #0) (.def# frac$ - ("lux type check" - {#Function Frac Code} - ([_ value] (_ann {#Frac value}))) + (.is# {#Function Frac Code} + ([_ value] (_ann {#Frac value}))) #0) (.def# text$ - ("lux type check" - {#Function Text Code} - ([_ text] (_ann {#Text text}))) + (.is# {#Function Text Code} + ([_ text] (_ann {#Text text}))) #0) (.def# symbol$ - ("lux type check" - {#Function Symbol Code} - ([_ name] (_ann {#Symbol name}))) + (.is# {#Function Symbol Code} + ([_ name] (_ann {#Symbol name}))) #0) (.def# local$ - ("lux type check" - {#Function Text Code} - ([_ name] (_ann {#Symbol ["" name]}))) + (.is# {#Function Text Code} + ([_ name] (_ann {#Symbol ["" name]}))) #0) (.def# form$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Form tokens}))) + (.is# {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Form tokens}))) #0) (.def# variant$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Variant tokens}))) + (.is# {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Variant tokens}))) #0) (.def# tuple$ - ("lux type check" - {#Function {#Apply Code List} Code} - ([_ tokens] (_ann {#Tuple tokens}))) + (.is# {#Function {#Apply Code List} Code} + ([_ tokens] (_ann {#Tuple tokens}))) #0) ... (type .public Definition ... [Bit Type Any]) (.def# Definition - ("lux type check" - Type - {#Named [..prelude "Definition"] - {#Product Bit {#Product Type Any}}}) + (.is# Type + {#Named [..prelude "Definition"] + {#Product Bit {#Product Type Any}}}) .public) ... (type .public Default ... Definition) (.def# Default - ("lux type check" - Type - {#Named [..prelude "Default"] - Definition}) + (.is# Type + {#Named [..prelude "Default"] + Definition}) .public) ... (type .public Alias ... Symbol) (.def# Alias - ("lux type check" - Type - {#Named [..prelude "Alias"] - Symbol}) + (.is# Type + {#Named [..prelude "Alias"] + Symbol}) .public) ... (type .public Global @@ -548,21 +518,19 @@ ... {#Alias Alias} ... {#Default Default})) (.def# Global - ("lux type check" - Type - {#Named [..prelude "Global"] - {#Sum Definition - {#Sum Alias - Default}}}) + (.is# 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}}}}) + (.is# {#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) @@ -573,26 +541,24 @@ ... [#counter Nat ... #mappings (List [k v])])) (.def# Bindings - ("lux type check" - Type - {#Named [..prelude "Bindings"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Product - ... counter - Nat - ... mappings - {#Apply {#Product {#Parameter 3} - {#Parameter 1}} - List}}}}}) + (.is# 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}}}) + (.is# {#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) @@ -601,22 +567,20 @@ ... {#Local Nat} ... {#Captured Nat}) (.def# Ref - ("lux type check" - Type - {#Named [..prelude "Ref"] - {#Sum - ... Local - Nat - ... Captured - Nat}}) + (.is# 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}}}) + (.is# {#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) @@ -629,30 +593,28 @@ ... #locals (Bindings Text [Type Nat]) ... #captured (Bindings Text [Type Ref])])) (.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}}}}}}) + (.is# 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}}}}}) + (.is# {#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) @@ -660,9 +622,8 @@ (.def# #captured (slot [{#Some [2 #1 ..scope_slots]} Scope]) .public) (.def# Code_List - ("lux type check" - Type - {#Apply Code List}) + (.is# Type + {#Apply Code List}) #0) ... (type .public (Either l r) @@ -670,24 +631,22 @@ ... {#Left l} ... {#Right r})) (.def# Either - ("lux type check" - Type - {#Named [..prelude "Either"] - {#UnivQ {#End} - {#UnivQ {#End} - {#Sum - ... Left - {#Parameter 3} - ... Right - {#Parameter 1}}}}}) + (.is# 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}}}) + (.is# {#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) @@ -695,10 +654,9 @@ ... (type .public Source ... [Location Nat Text]) (.def# Source - ("lux type check" - Type - {#Named [..prelude "Source"] - {#Product Location {#Product Nat Text}}}) + (.is# Type + {#Named [..prelude "Source"] + {#Product Location {#Product Nat Text}}}) .public) ... (type .public Module_State @@ -707,26 +665,24 @@ ... #Compiled ... #Cached)) (.def# Module_State - ("lux type check" - Type - {#Named [..prelude "Module_State"] - {#Sum - ... #Active - Any - {#Sum - ... #Compiled - Any - ... #Cached - Any}}}) + (.is# 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}}}}) + (.is# {#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) @@ -740,35 +696,33 @@ ... #imports (List Text) ... #module_state Module_State])) (.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 - }}}}}) + (.is# 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}}}}}}) + (.is# {#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) @@ -782,25 +736,23 @@ ... #var_counter Nat ... #var_bindings (List [Nat (Maybe Type)])])) (.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}}}}) + (.is# 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}}}}) + (.is# {#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) @@ -812,26 +764,24 @@ ... {#Eval} ... {#Interpreter})) (.def# Mode - ("lux type check" - Type - {#Named [..prelude "Mode"] - {#Sum - ... Build - Any - {#Sum - ... Eval - Any - ... Interpreter - Any}}}) + (.is# 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}}}}) + (.is# {#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) @@ -844,30 +794,28 @@ ... #mode Mode ... #configuration (List [Text Text])])) (.def# Info - ("lux type check" - Type - {#Named [..prelude "Info"] - {#Product - ... target - Text - {#Product - ... version - Text - {#Product - ... mode - Mode - ... configuration - {#Apply {#Product Text Text} List}}}}}) + (.is# 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}}}}}) + (.is# {#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) @@ -891,73 +839,71 @@ ... #eval (-> Type Code (-> Lux (Either Text [Lux Any]))) ... #host Any]))) (.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} + (.is# Type + {#Named [..prelude "Lux"] + ({Lux + {#Apply {0 #0 ["" {#End}]} + {#UnivQ {#End} {#Product - ... scopes - {#Apply Scope List} + ... info + Info {#Product - ... type_context - Type_Context + ... source + Source {#Product - ... expected - {#Apply Type Maybe} + ... location + Location {#Product - ... seed - Nat + ... current_module + {#Apply Text Maybe} {#Product - ... scope_type_vars - {#Apply Nat List} + ... modules + {#Apply {#Product Text Module} List} {#Product - ... extensions - Any + ... scopes + {#Apply Scope List} {#Product - ... eval - {#Function Type - {#Function Code - {#Function Lux - {#Sum Text {#Product Lux Any}}}}} - ... host - Any}}}}}}}}}}}}}}} - {#Apply {0 #0 ["" {#End}]} {#Parameter 0}})}) + ... 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}}}}}}}}}}}}}}) + (.is# {#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) @@ -976,210 +922,197 @@ ... (type .public (Meta a) ... (-> Lux (Either Text [Lux a]))) (.def# Meta - ("lux type check" - Type - {#Named [..prelude "Meta"] - {#UnivQ {#End} - {#Function Lux - {#Apply {#Product Lux {#Parameter 1}} - {#Apply Text Either}}}}}) + (.is# 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)))) (.def# Macro' - ("lux type check" - Type - {#Named [..prelude "Macro'"] - {#Function Code_List {#Apply Code_List Meta}}}) + (.is# Type + {#Named [..prelude "Macro'"] + {#Function Code_List {#Apply Code_List Meta}}}) .public) ... (type .public Macro ... (Primitive "#Macro")) (.def# Macro - ("lux type check" - Type - {#Named [..prelude "Macro"] - {#Primitive "#Macro" {#End}}}) + (.is# Type + {#Named [..prelude "Macro"] + {#Primitive "#Macro" {#End}}}) .public) ... Base functions & macros (.def# meta#in - ("lux type check" - {#UnivQ {#End} {#Function {#Parameter 1} {#Apply {#Parameter 1} Meta}}} - ([_ val] - ([_ state] - {#Right [state val]}))) + (.is# {#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}))) + (.is# {#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)))) + (.is# {#Function Text {#Function Text Text}} + ([_ x] + ([_ y] + (.text_composite# x y)))) #0) (.def# symbol_separator - ("lux type check" - Text - ".") + (.is# 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))) + (.is# {#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. (.def# wrong_syntax_error - ("lux type check" - {#Function Symbol Text} - ([_ it] - (text#composite "Wrong syntax for " (symbol#encoded it)))) + (.is# {#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)))) + (.as# Macro + (.is# 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) (.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 function''")} - tokens)))) + (.as# Macro + (.is# 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 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}}}}}))) + (.is# {#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}}}}))) + (.is# {#Function Code {#Function Code Code}} + (function'' [type value] + (form$ {#Item (symbol$ [..prelude "is#"]) {#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))) + (.is# {#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}}}}))) + (.is# {#Function Code Code} + (function'' [expression] + (form$ {#Item (symbol$ [..prelude "as#"]) + {#Item (symbol$ [..prelude "Macro"]) + {#Item (form$ {#Item (symbol$ [..prelude "is#"]) + {#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)))) + (.as# Macro + (.is# 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)))) + (.as# Macro + (.is# 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 @@ -1222,10 +1155,9 @@ (def' .private (list#reversed list) {#UnivQ {#End} {#Function ($ List {#Parameter 1}) ($ List {#Parameter 1})}} - (list#mix ("lux type check" - {#UnivQ {#End} - {#Function {#Parameter 1} {#Function ($ List {#Parameter 1}) ($ List {#Parameter 1})}}} - (function'' [head tail] {#Item head tail})) + (list#mix (.is# {#UnivQ {#End} + {#Function {#Parameter 1} {#Function ($ List {#Parameter 1}) ($ List {#Parameter 1})}}} + (function'' [head tail] {#Item head tail})) {#End} list)) @@ -1254,7 +1186,7 @@ (def' .private (text#= reference sample) {#Function Text {#Function Text Bit}} - ("lux text =" reference sample)) + (.text_=# reference sample)) (def' .private (replacement for environment) {#Function Text {#Function Replacement_Environment ($ Maybe Code)}} @@ -1292,15 +1224,14 @@ (def' .private (n/* param subject) {#Function Nat {#Function Nat Nat}} - ("lux type as" Nat - ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int subject)))) + (.as# Nat + (.int_*# (.as# Int param) + (.as# Int subject)))) (def' .private (list#size list) {#UnivQ {#End} {#Function ($ List {#Parameter 1}) Nat}} - (list#mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) + (list#mix (function'' [_ acc] (.i64_+# 1 acc)) 0 list)) (def' .private (let$ binding value body) {#Function Code {#Function Code {#Function Code Code}}} @@ -1328,9 +1259,9 @@ (def' .private quantification_level Text - ("lux text concat" double_quote - ("lux text concat" "quantification_level" - double_quote))) + (.text_composite# double_quote + (.text_composite# "quantification_level" + double_quote))) (def' .private quantified {#Function Code Code} @@ -1339,7 +1270,7 @@ (def' .private (quantified_type_parameter idx) {#Function Nat Code} (variant$ {#Item (symbol$ [..prelude "#Parameter"]) - {#Item (form$ {#Item (text$ "lux i64 +") + {#Item (form$ {#Item (symbol$ [..prelude "i64_+#"]) {#Item (local$ ..quantification_level) {#Item (nat$ idx) {#End}}}}) @@ -1347,15 +1278,15 @@ (def' .private (next_level depth) {#Function Nat Nat} - ("lux i64 +" 2 depth)) + (.i64_+# 2 depth)) (def' .private (self_id? id) {#Function Nat Bit} - ("lux i64 =" id ("lux type as" Nat - ("lux i64 *" +2 - ("lux i64 /" +2 - ("lux type as" Int - id)))))) + (.i64_=# id (.as# Nat + (.int_*# +2 + (.int_/# +2 + (.as# Int + id)))))) (def' .public (__adjusted_quantified_type__ permission depth type) {#Function Nat {#Function Nat {#Function Type Type}}} @@ -1364,9 +1295,9 @@ {#Parameter id} ({id' ({[#0] {#Parameter id'} - [#1] {#Parameter ("lux i64 -" 2 id')}} + [#1] {#Parameter (.i64_-# 2 id')}} (self_id? id))} - ("lux i64 -" ("lux i64 -" depth id) 0)) + (.i64_-# (.i64_-# depth id) 0)) ... Recur {#Primitive name parameters} @@ -1419,12 +1350,12 @@ {#Function Nat {#Function Code Code}} ({g!level (let$ g!level - (form$ {#Item (text$ "lux i64 +") + (form$ {#Item (symbol$ [..prelude "i64_+#"]) {#Item g!level - {#Item (nat$ ("lux type as" Nat - ("lux i64 *" +2 - ("lux type as" Int - depth)))) + {#Item (nat$ (.as# Nat + (.int_*# +2 + (.as# Int + depth)))) {#End}}}}) body)} (local$ ..quantification_level))) @@ -1443,7 +1374,7 @@ (list#mix (function'' [local verdict] ({[local _] ({[#1] #1 - _ ("lux text =" ..quantification_level local)} + _ (.text_=# ..quantification_level local)} verdict)} local)) #0 @@ -1474,8 +1405,8 @@ raw} (list#mix (function'' [parameter offset,body'] ({[offset body'] - [("lux i64 +" 2 offset) - (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + [(.i64_+# 2 offset) + (let$ parameter (quantified_type_parameter (.i64_+# offset 1)) (UnivQ$ body'))]} offset,body')) [0 (with_quantification (list#size args) @@ -1508,8 +1439,8 @@ raw} (list#mix (function'' [parameter offset,body'] ({[offset body'] - [("lux i64 +" 2 offset) - (let$ parameter (quantified_type_parameter ("lux i64 +" offset 1)) + [(.i64_+# 2 offset) + (let$ parameter (quantified_type_parameter (.i64_+# offset 1)) (ExQ$ body'))]} offset,body')) [0 (with_quantification (list#size args) @@ -1526,9 +1457,8 @@ Macro (macro (_ tokens) ({{#Item output inputs} - (meta#in {#Item (list#mix ("lux type check" - {#Function Code {#Function Code Code}} - (function'' [i o] (variant$ {#Item (symbol$ [..prelude "#Function"]) {#Item i {#Item o {#End}}}}))) + (meta#in {#Item (list#mix (.is# {#Function Code {#Function Code Code}} + (function'' [i o] (variant$ {#Item (symbol$ [..prelude "#Function"]) {#Item i {#Item o {#End}}}}))) output inputs) {#End}}) @@ -1635,13 +1565,12 @@ (macro (_ tokens) ({{#Item [_ {#Tuple bindings}] {#Item body {#End}}} ({{#Some bindings} - (meta#in (list (list#mix ("lux type check" - (-> (Tuple Code Code) Code - Code) - (function' [binding body] - ({[label value] - (form$ (list (variant$ (list label body)) value))} - binding))) + (meta#in (list (list#mix (.is# (-> (Tuple Code Code) Code + Code) + (function' [binding body] + ({[label value] + (form$ (list (variant$ (list label body)) value))} + binding))) body (list#reversed bindings)))) @@ -1740,23 +1669,21 @@ ... (is (All (_ a b) (-> (-> a (m b)) (m a) (m b))) ... #then))) (.def# Monad - ("lux type check" - Type - {#Named [..prelude "Monad"] - (All (_ !) - (Tuple (All (_ a) - (-> a ($ ! a))) - (All (_ a b) - (-> (-> a ($ ! b)) - (-> ($ ! a) ($ ! b))))))}) + (.is# 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}}}) + (.is# {#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) @@ -1799,26 +1726,25 @@ ({{#Some bindings} (let' [g!in (local$ "in") g!then (local$ " then ") - body' (list#mix ("lux type check" - (-> (Tuple Code Code) Code Code) - (function' [binding body'] - (let' [[var value] binding] - ({[_ {#Symbol [module short]}] - ({"" - (form$ (list g!then - (form$ (list (tuple$ (list (local$ "") var)) body')) - value)) - - _ - (form$ (list var value body'))} - module) - - - _ - (form$ (list g!then - (form$ (list (tuple$ (list (local$ "") var)) body')) - value))} - var)))) + body' (list#mix (.is# (-> (Tuple Code Code) Code Code) + (function' [binding body'] + (let' [[var value] binding] + ({[_ {#Symbol [module short]}] + ({"" + (form$ (list g!then + (form$ (list (tuple$ (list (local$ "") var)) body')) + value)) + + _ + (form$ (list var value body'))} + module) + + + _ + (form$ (list g!then + (form$ (list (tuple$ (list (local$ "") var)) body')) + value))} + var)))) body (list#reversed bindings))] (meta#in (list (form$ (list (variant$ (list (tuple$ (list g!in g!then)) @@ -1939,7 +1865,7 @@ (let' [type (variant$ (list (symbol$ [..prelude "#Apply"]) (symbol$ [..prelude "Code"]) (symbol$ [..prelude "List"])))] - (form$ (list (text$ "lux type check") type expression)))) + (form$ (list (symbol$ [..prelude "is#"]) type expression)))) (def' .private (untemplated_text value) (-> Text Code) @@ -1953,11 +1879,11 @@ (def' .public (unquote it) (-> Macro UnQuote) - ("lux type as" UnQuote it)) + (.as# UnQuote it)) (def' .public (unquote_macro it) (-> UnQuote Macro') - ("lux type as" Macro' it)) + (.as# Macro' it)) (def' .public Spliced_UnQuote Type @@ -1966,11 +1892,11 @@ (def' .public (spliced_unquote it) (-> Macro Spliced_UnQuote) - ("lux type as" Spliced_UnQuote it)) + (.as# Spliced_UnQuote it)) (def' .public (spliced_unquote_macro it) (-> Spliced_UnQuote Macro') - ("lux type as" Macro' it)) + (.as# Macro' it)) (def' .private (list#one f xs) (All (_ a b) @@ -1993,21 +1919,19 @@ ..#scopes scopes ..#type_context types ..#host host ..#seed seed ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] state] - (list#one ("lux type check" - (-> Scope ($ Maybe Type)) - (function' [env] - (let' [[..#scope_name _ - ..#inner_scopes _ - ..#locals [..#counter _ ..#mappings locals] - ..#captured _] env] - (list#one ("lux type check" - (-> (Tuple Text (Tuple Type Any)) ($ Maybe Type)) - (function' [it] - (let' [[bname [type _]] it] - (if (text#= name bname) - {#Some type} - {#None})))) - locals)))) + (list#one (.is# (-> Scope ($ Maybe Type)) + (function' [env] + (let' [[..#scope_name _ + ..#inner_scopes _ + ..#locals [..#counter _ ..#mappings locals] + ..#captured _] env] + (list#one (.is# (-> (Tuple Text (Tuple Type Any)) ($ Maybe Type)) + (function' [it] + (let' [[bname [type _]] it] + (if (text#= name bname) + {#Some type} + {#None})))) + locals)))) scopes))) (def' .private (available? expected_module current_module exported?) @@ -2121,7 +2045,7 @@ ({[{#Primitive nameL parametersL} {#Primitive nameR parametersR}] (all and' (text#= nameL nameR) - ("lux i64 =" (list#size parametersL) (list#size parametersR)) + (.i64_=# (list#size parametersL) (list#size parametersR)) (every? (function' [l,r] (let' [[itL itR] l,r] (type#= itL itR))) (zipped_2 parametersL parametersR))) @@ -2146,24 +2070,24 @@ (type#= rightL rightR)) [{#Parameter idL} {#Parameter idR}] - ("lux i64 =" idL idR) + (.i64_=# idL idR) [{#Var idL} {#Var idR}] - ("lux i64 =" idL idR) + (.i64_=# idL idR) [{#Ex idL} {#Ex idR}] - ("lux i64 =" idL idR) + (.i64_=# idL idR) [{#UnivQ envL bodyL} {#UnivQ envR bodyR}] (all and' - ("lux i64 =" (list#size envL) (list#size envR)) + (.i64_=# (list#size envL) (list#size envR)) (every? (function' [l,r] (let' [[itL itR] l,r] (type#= itL itR))) (zipped_2 envL envR)) (type#= bodyL bodyR)) [{#ExQ envL bodyL} {#ExQ envR bodyR}] (all and' - ("lux i64 =" (list#size envL) (list#size envR)) + (.i64_=# (list#size envL) (list#size envR)) (every? (function' [l,r] (let' [[itL itR] l,r] (type#= itL itR))) (zipped_2 envL envR)) (type#= bodyL bodyR)) @@ -2217,12 +2141,11 @@ (-> Text Location (-> Bit Text Code ($ Meta Code)) Bit Text ($ List Code) ($ Meta Code)) (do meta#monad - [.let' [cons ("lux type check" - (-> Code Code ($ Meta Code)) - (function' [head tail] - (do meta#monad - [head (untemplated replace? subst head)] - (in (|#Item| head tail)))))] + [.let' [cons (.is# (-> Code Code ($ Meta Code)) + (function' [head tail] + (do meta#monad + [head (untemplated replace? subst head)] + (in (|#Item| head tail)))))] output (if replace? (monad#mix meta#monad (function' [head tail] @@ -2233,7 +2156,7 @@ ({{#Some [type value]} (if (type#= Spliced_UnQuote type) (do meta#monad - [.let' [it (spliced_unquote_macro ("lux type as" Spliced_UnQuote value))] + [.let' [it (spliced_unquote_macro (.as# Spliced_UnQuote value))] output (one_expansion (it {#Item tail parameters})) .let' [[_ output] output]] (in [@composite output])) @@ -2320,7 +2243,7 @@ ({{#Some [type value]} (if (type#= UnQuote type) (do meta#monad - [.let' [it (unquote_macro ("lux type as" UnQuote value))] + [.let' [it (unquote_macro (.as# UnQuote value))] output (one_expansion (it parameters)) .let' [[_ output] output]] (in [@composite output])) @@ -2360,7 +2283,7 @@ (do meta#monad [current_module current_module_name =template (untemplated #1 current_module template)] - (in (list (form$ (list (text$ "lux type check") + (in (list (form$ (list (symbol$ [..prelude "is#"]) (symbol$ [..prelude "Code"]) =template))))) @@ -2376,7 +2299,7 @@ ({{#Item template {#End}} (do meta#monad [=template (untemplated #1 "" template)] - (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) + (in (list (form$ (list (symbol$ [..prelude "is#"]) (symbol$ [..prelude "Code"]) =template))))) _ (failure (wrong_syntax_error [..prelude "`'"]))} @@ -2390,7 +2313,7 @@ ({{#Item template {#End}} (do meta#monad [=template (untemplated #0 "" template)] - (in (list (form$ (list (text$ "lux type check") (symbol$ [..prelude "Code"]) =template))))) + (in (list (form$ (list (symbol$ [..prelude "is#"]) (symbol$ [..prelude "Code"]) =template))))) _ (failure (wrong_syntax_error [..prelude "'"]))} @@ -2403,7 +2326,7 @@ (..unquote (macro (_ tokens) ({{#Item it {#End}} - (meta#in (list (form$ (list (text$ "lux type check") + (meta#in (list (form$ (list (symbol$ [..prelude "is#"]) (symbol$ [..prelude "Code"]) it)))) @@ -2431,7 +2354,7 @@ (def' .public ,* Spliced_UnQuote - (let' [g!list#composite (form$ (list (text$ "lux in-module") + (let' [g!list#composite (form$ (list (symbol$ [..prelude "in_module#"]) (text$ ..prelude) (symbol$ [..prelude "list#composite"])))] (..spliced_unquote @@ -2449,21 +2372,20 @@ Macro (macro (_ tokens) ({{#Item [init apps]} - (meta#in (list (list#mix ("lux type check" - (-> Code Code Code) - (function' [app acc] - ({[_ {#Variant parts}] - (variant$ (list#composite parts (list acc))) + (meta#in (list (list#mix (.is# (-> Code Code Code) + (function' [app acc] + ({[_ {#Variant parts}] + (variant$ (list#composite parts (list acc))) - [_ {#Tuple parts}] - (tuple$ (list#composite parts (list acc))) + [_ {#Tuple parts}] + (tuple$ (list#composite parts (list acc))) - [_ {#Form parts}] - (form$ (list#composite parts (list acc))) + [_ {#Form parts}] + (form$ (list#composite parts (list acc))) - _ - (` ((, app) (, acc)))} - app))) + _ + (` ((, app) (, acc)))} + app))) init apps))) @@ -2475,21 +2397,20 @@ Macro (macro (_ tokens) ({{#Item [init apps]} - (meta#in (list (list#mix ("lux type check" - (-> Code Code Code) - (function' [app acc] - ({[_ {#Variant parts}] - (variant$ (list#composite parts (list acc))) + (meta#in (list (list#mix (.is# (-> Code Code Code) + (function' [app acc] + ({[_ {#Variant parts}] + (variant$ (list#composite parts (list acc))) - [_ {#Tuple parts}] - (tuple$ (list#composite parts (list acc))) + [_ {#Tuple parts}] + (tuple$ (list#composite parts (list acc))) - [_ {#Form parts}] - (form$ (list#composite parts (list acc))) + [_ {#Form parts}] + (form$ (list#composite parts (list acc))) - _ - (` ((, app) (, acc)))} - app))) + _ + (` ((, app) (, acc)))} + app))) init apps))) @@ -2554,26 +2475,25 @@ (def' .private (high_bits value) (-> ($ I64 Any) I64) - ("lux i64 right-shift" 32 value)) + (.i64_right# 32 value)) (def' .private low_mask I64 - (|> 1 ("lux i64 left-shift" 32) ("lux i64 -" 1))) + (|> 1 (.i64_left# 32) (.i64_-# 1))) (def' .private (low_bits value) (-> ($ I64 Any) I64) - ("lux i64 and" low_mask value)) + (.i64_and# low_mask value)) (def' .private (n/< reference sample) (-> Nat Nat Bit) (let' [referenceH (high_bits reference) sampleH (high_bits sample)] - (if ("lux i64 <" referenceH sampleH) + (if (.int_<# referenceH sampleH) #1 - (if ("lux i64 =" referenceH sampleH) - ("lux i64 <" - (low_bits reference) - (low_bits sample)) + (if (.i64_=# referenceH sampleH) + (.int_<# (low_bits reference) + (low_bits sample)) #0)))) (def' .private (list#conjoint xs) @@ -2596,11 +2516,10 @@ (macro (_ tokens) ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} ({[{#Some bindings'} {#Some data'}] - (let' [apply ("lux type check" - (-> Replacement_Environment ($ List Code)) - (function' [env] (list#each (realized_template env) templates))) + (let' [apply (.is# (-> Replacement_Environment ($ List Code)) + (function' [env] (list#each (realized_template env) templates))) num_bindings (list#size bindings')] - (if (every? (function' [size] ("lux i64 =" num_bindings size)) + (if (every? (function' [size] (.i64_=# num_bindings size)) (list#each list#size data')) (|> data' (list#each (function#composite apply (replacement_environment bindings'))) @@ -2619,28 +2538,26 @@ (def' .private (n// param subject) (-> Nat Nat Nat) - (if ("lux i64 <" +0 ("lux type as" Int param)) + (if (.int_<# +0 (.as# Int param)) (if (n/< param subject) 0 1) (let' [quotient (|> subject - ("lux i64 right-shift" 1) - ("lux i64 /" ("lux type as" Int param)) - ("lux i64 left-shift" 1)) - flat ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int quotient)) - remainder ("lux i64 -" flat subject)] + (.i64_right# 1) + (.int_/# (.as# Int param)) + (.i64_left# 1)) + flat (.int_*# (.as# Int param) + (.as# Int quotient)) + remainder (.i64_-# flat subject)] (if (n/< param remainder) quotient - ("lux i64 +" 1 quotient))))) + (.i64_+# 1 quotient))))) (def' .private (n/% param subject) (-> Nat Nat Nat) - (let' [flat ("lux i64 *" - ("lux type as" Int param) - ("lux type as" Int (n// param subject)))] - ("lux i64 -" flat subject))) + (let' [flat (.int_*# (.as# Int param) + (.as# Int (n// param subject)))] + (.i64_-# flat subject))) (def' .private (n/min left right) (-> Nat Nat Nat) @@ -2658,50 +2575,48 @@ [1] "1" [2] "2" [3] "3" [4] "4" [5] "5" [6] "6" [7] "7" [8] "8" [9] "9" - _ ("lux io error" "@digit::format Undefined behavior.")} + _ (.error# "@digit::format Undefined behavior.")} digit)) (def' .private (nat#encoded value) (-> Nat Text) ({[0] "0" - _ (let' [loop ("lux type check" - (-> Nat Text Text) - (function' again [input output] - (if ("lux i64 =" 0 input) - output - (again (n// 10 input) - (text#composite (|> input (n/% 10) digit::format) - output)))))] + _ (let' [loop (.is# (-> Nat Text Text) + (function' again [input output] + (if (.i64_=# 0 input) + output + (again (n// 10 input) + (text#composite (|> input (n/% 10) digit::format) + output)))))] (loop value ""))} value)) (def' .private (int#abs value) (-> Int Int) - (if ("lux i64 <" +0 value) - ("lux i64 *" -1 value) + (if (.int_<# +0 value) + (.int_*# -1 value) value)) (def' .private (int#encoded value) (-> Int Text) - (if ("lux i64 =" +0 value) + (if (.i64_=# +0 value) "+0" - (let' [sign (if ("lux i64 <" value +0) + (let' [sign (if (.int_<# value +0) "+" "-")] - (("lux type check" - (-> Int Text Text) - (function' again [input output] - (if ("lux i64 =" +0 input) - (text#composite sign output) - (again ("lux i64 /" +10 input) - (text#composite (|> input ("lux i64 %" +10) ("lux type as" Nat) digit::format) - output))))) - (|> value ("lux i64 /" +10) int#abs) - (|> value ("lux i64 %" +10) int#abs ("lux type as" Nat) digit::format))))) + ((.is# (-> Int Text Text) + (function' again [input output] + (if (.i64_=# +0 input) + (text#composite sign output) + (again (.int_/# +10 input) + (text#composite (|> input (.int_%# +10) (.as# Nat) digit::format) + output))))) + (|> value (.int_/# +10) int#abs) + (|> value (.int_%# +10) int#abs (.as# Nat) digit::format))))) (def' .private (frac#encoded x) (-> Frac Text) - ("lux f64 encode" x)) + (.f64_encoded# x)) (def' .public (not x) (-> Bit Bit) @@ -2722,7 +2637,7 @@ ($ Maybe Macro)) (do maybe#monad [$module (property#value module modules) - gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] ("lux type check" Module $module)] + gdef (let' [[..#module_hash _ ..#module_aliases _ ..#definitions bindings ..#imports _ ..#module_state _] (.is# Module $module)] (property#value name bindings))] ({{#Alias [r_module r_name]} (named_macro' modules current_module r_module r_name) @@ -2730,15 +2645,15 @@ {#Definition [exported? def_type def_value]} (if (macro_type? def_type) (if exported? - {#Some ("lux type as" Macro def_value)} + {#Some (.as# Macro def_value)} (if (text#= module current_module) - {#Some ("lux type as" Macro def_value)} + {#Some (.as# Macro def_value)} {#None})) {#None}) {#Default _} {#None}} - ("lux type check" Global gdef)))) + (.is# Global gdef)))) (def' .private (named_macro full_name) (-> Symbol ($ Meta ($ Maybe Macro))) @@ -2783,7 +2698,7 @@ [name' (normal name) ?macro (named_macro name')] ({{#Some macro} - (("lux type as" Macro' macro) args) + ((.as# Macro' macro) args) {#None} (in (list token))} @@ -2801,7 +2716,7 @@ ?macro (named_macro name')] ({{#Some macro} (do meta#monad - [top_level_expansion (("lux type as" Macro' macro) args) + [top_level_expansion ((.as# Macro' macro) args) recursive_expansion (monad#each meta#monad complete_expansion top_level_expansion)] (in (list#conjoint recursive_expansion))) @@ -2820,7 +2735,7 @@ ?macro (named_macro name')] ({{#Some macro} (do meta#monad - [expansion (("lux type as" Macro' macro) args) + [expansion ((.as# Macro' macro) args) expansion' (monad#each meta#monad total_expansion expansion)] (in (list#conjoint expansion'))) @@ -2911,7 +2826,7 @@ (int#encoded value) [_ {#Rev value}] - ("lux io error" "@code#encoded Undefined behavior.") + (.error# "@code#encoded Undefined behavior.") [_ {#Frac value}] (frac#encoded value) @@ -2956,13 +2871,13 @@ [members (monad#each meta#monad normal_type members)] (in (` (Tuple (,* members))))) - [_ {#Form {#Item [_ {#Text "lux in-module"}] + [_ {#Form {#Item [_ {#Symbol ["library/lux" "in_module#"]}] {#Item [_ {#Text module}] {#Item type' {#End}}}}}] (do meta#monad [type' (normal_type type')] - (in (` ("lux in-module" (, (text$ module)) (, type'))))) + (in (` (.in_module# (, (text$ module)) (, type'))))) [_ {#Form {#Item [_ {#Symbol ["" ","]}] {#Item expression {#End}}}}] (meta#in expression) @@ -2993,9 +2908,8 @@ (do meta#monad [type_fn (normal_type type_fn) args (monad#each meta#monad normal_type args)] - (in (list#mix ("lux type check" - (-> Code Code Code) - (function' [arg type_fn] (` {.#Apply (, arg) (, type_fn)}))) + (in (list#mix (.is# (-> Code Code Code) + (function' [arg type_fn] (` {.#Apply (, arg) (, type_fn)}))) type_fn args))) @@ -3056,7 +2970,7 @@ ..#scopes (list#partial [#scope_name (list) #inner_scopes 0 #locals [#counter 0 - #mappings (list [..quantification_level [.Nat ("lux type as" Nat -1)]])] + #mappings (list [..quantification_level [.Nat (.as# Nat -1)]])] #captured [#counter 0 #mappings (list)]] scopes/pre) @@ -3100,9 +3014,8 @@ Macro (macro (_ tokens) ({{#Item type {#Item value {#End}}} - (meta#in (list (` ("lux type check" - (..type_literal (, type)) - (, value))))) + (meta#in (list (` (.is# (..type_literal (, type)) + (, value))))) _ (failure (..wrong_syntax_error (symbol ..is)))} @@ -3112,9 +3025,8 @@ Macro (macro (_ tokens) ({{#Item type {#Item value {#End}}} - (meta#in (list (` ("lux type as" - (..type_literal (, type)) - (, value))))) + (meta#in (list (` (.as# (..type_literal (, type)) + (, value))))) _ (failure (..wrong_syntax_error (symbol ..as)))} @@ -3146,7 +3058,7 @@ ..#scope_type_vars scope_type_vars ..#eval _eval] {#Right [..#info info ..#source source ..#current_module _ ..#modules modules ..#scopes scopes ..#type_context types ..#host host - ..#seed ("lux i64 +" 1 seed) ..#expected expected + ..#seed (.i64_+# 1 seed) ..#expected expected ..#location location ..#extensions extensions ..#scope_type_vars scope_type_vars ..#eval _eval] (local$ (all text#composite "__gensym__" prefix (nat#encoded seed)))}} @@ -3157,9 +3069,8 @@ (macro (_ tokens) ({{#Item value actions} (let' [dummy (local$ "")] - (meta#in (list (list#mix ("lux type check" - (-> Code Code Code) - (function' [pre post] (` ({(, dummy) (, post)} (, pre))))) + (meta#in (list (list#mix (.is# (-> Code Code Code) + (function' [pre post] (` ({(, dummy) (, post)} (, pre))))) value actions)))) @@ -3347,11 +3258,11 @@ (def' .public (pattern it) (-> Macro Pattern) - ("lux type as" Pattern it)) + (.as# Pattern it)) (def' .public (pattern_macro it) (-> Pattern Macro') - ("lux type as" Macro' it)) + (.as# Macro' it)) (def' .private (when_expansion#macro when_expansion pattern body branches) (type_literal (-> (-> (List Code) (Meta (List Code))) @@ -3374,7 +3285,7 @@ ({{#Some [type value]} (if (type#= Pattern type) (do meta#monad - [branches'' ((pattern_macro ("lux type as" Pattern value)) + [branches'' ((pattern_macro (.as# Pattern value)) (list#partial (form$ parameters) body branches'))] (when_expansion branches'')) (when_expansion#macro when_expansion [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}] body branches')) @@ -3813,11 +3724,11 @@ (def (index part text) (-> Text Text (Maybe Nat)) - ("lux text index" 0 part text)) + (.text_index# 0 part text)) (def .public (panic! message) (-> Text Nothing) - ("lux io error" message)) + (.error# message)) (def maybe#else (macro (_ tokens state) @@ -3842,13 +3753,12 @@ (list input) {#Some idx} - (list#partial ("lux text clip" 0 idx input) + (list#partial (.text_clip# 0 idx input) (text#all_split_by splitter - (let [after_offset ("lux i64 +" 1 idx) - after_length ("lux i64 -" - after_offset - ("lux text size" input))] - ("lux text clip" after_offset after_length input)))))) + (let [after_offset (.i64_+# 1 idx) + after_length (.i64_-# after_offset + (.text_size# input))] + (.text_clip# after_offset after_length input)))))) (def (item idx xs) (All (_ a) @@ -3858,9 +3768,9 @@ {#None} {#Item x xs'} - (if ("lux i64 =" 0 idx) + (if (.i64_=# 0 idx) {#Some x} - (item ("lux i64 -" 1 idx) xs')))) + (item (.i64_-# 1 idx) xs')))) ... https://en.wikipedia.org/wiki/Lambda_calculus#%CE%B2-reduction (def (reduced env type) @@ -4256,7 +4166,7 @@ (-> Nat (List a) (List [Nat a]))) (when xs {#Item x xs'} - {#Item [idx x] (enumeration' ("lux i64 +" 1 idx) xs')} + {#Item [idx x] (enumeration' (.i64_+# 1 idx) xs')} {#End} {#End})) @@ -4285,7 +4195,7 @@ (` (def (, export_policy) (, (local$ right)) (<| (as (, label_type)) (is Label) - [{#Some [(, (nat$ ("lux i64 -" 1 (list#size lefts)))) #1 (, family)]} (, associated_type)]))) + [{#Some [(, (nat$ (.i64_-# 1 (list#size lefts)))) #1 (, family)]} (, associated_type)]))) (list#each (function (_ [lefts it]) (` (def (, export_policy) (, (local$ it)) (<| (as (, label_type)) @@ -4367,15 +4277,15 @@ (def (text#split_at' at x) (-> Nat Text [Text Text]) - [("lux text clip" 0 at x) - ("lux text clip" at (|> x "lux text size" ("lux i64 -" at)) x)]) + [(.text_clip# 0 at x) + (.text_clip# at (|> x .text_size# (.i64_-# at)) x)]) (def (text#split_by token sample) (-> Text Text (Maybe [Text Text])) (do ..maybe#monad [index (..index token sample) .let [[pre post'] (text#split_at' index sample) - [_ post] (text#split_at' ("lux text size" token) post')]] + [_ post] (text#split_at' (.text_size# token) post')]] (in [pre post]))) (def (replaced pattern replacement template) @@ -4384,21 +4294,21 @@ (function (again left right) (when (..text#split_by pattern right) {#Some [pre post]} - (again (all "lux text concat" left pre replacement) post) + (again (all .text_composite# left pre replacement) post) {#None} - ("lux text concat" left right)))) + (.text_composite# left right)))) "" template)) (def (alias_stand_in index) (-> Nat Text) - (all "lux text concat" "[" (nat#encoded index) "]")) + (all .text_composite# "[" (nat#encoded index) "]")) (def (module_alias context aliased) (-> (List Text) Text Text) (product#right (list#mix (function (_ replacement [index aliased]) - [("lux i64 +" 1 index) + [(.i64_+# 1 index) (replaced (alias_stand_in index) replacement aliased)]) [0 aliased] context))) @@ -4433,13 +4343,13 @@ (def (relative_ups relatives input) (-> Nat Text Nat) - (when ("lux text index" relatives ..module_separator input) + (when (.text_index# relatives ..module_separator input) {#None} relatives {#Some found} - (if ("lux i64 =" relatives found) - (relative_ups ("lux i64 +" 1 relatives) input) + (if (.i64_=# relatives found) + (relative_ups (.i64_+# 1 relatives) input) relatives))) (def (list#after amount list) @@ -4450,31 +4360,31 @@ list [_ {#Item _ tail}] - (list#after ("lux i64 -" 1 amount) tail))) + (list#after (.i64_-# 1 amount) tail))) (def (absolute_module_name nested? relative_root module) (-> Bit Text Text (Meta Text)) (when (relative_ups 0 module) 0 (meta#in (if nested? - (all "lux text concat" relative_root ..module_separator module) + (all .text_composite# relative_root ..module_separator module) module)) relatives (let [parts (text#all_split_by ..module_separator relative_root) - jumps ("lux i64 -" 1 relatives)] + jumps (.i64_-# 1 relatives)] (if (n/< (list#size parts) jumps) (let [prefix (|> parts list#reversed (list#after jumps) list#reversed (text#interposed ..module_separator)) - clean ("lux text clip" relatives (|> module "lux text size" ("lux i64 -" relatives)) module) - output (when ("lux text size" clean) + clean (.text_clip# relatives (|> module .text_size# (.i64_-# relatives)) module) + output (when (.text_size# clean) 0 prefix _ (all text#composite prefix ..module_separator clean))] (meta#in output)) - (failure (all "lux text concat" + (failure (all .text_composite# "Cannot climb the module hierarchy..." \n "Importing module: " module \n " Relative Root: " relative_root \n)))))) @@ -4717,7 +4627,7 @@ {#End} {#Item [var bound] bindings'} - (if ("lux i64 =" idx var) + (if (.i64_=# idx var) bound (type_variable idx bindings')))) @@ -4932,11 +4842,11 @@ (function (again index input output) (when input (list#partial head tail) - (if ("lux i64 =" index (if right? - ("lux i64 +" 1 lefts) - lefts)) + (if (.i64_=# index (if right? + (.i64_+# 1 lefts) + lefts)) (list#reversed (list#partial g!output output)) - (again ("lux i64 +" 1 index) tail (list#partial g!_ output))) + (again (.i64_+# 1 index) tail (list#partial g!_ output))) (list) (list)))) @@ -4964,13 +4874,13 @@ [g!_ (..generated_symbol "_") g!output (..generated_symbol "") .let [idx (if right? - (is Nat ("lux i64 +" 1 lefts)) + (is Nat (.i64_+# 1 lefts)) lefts) pattern (|> (enumeration family) (list#each (is (-> [Nat Symbol] (List Code)) (function (_ [r_idx slot]) (list (symbol$ slot) - (if ("lux i64 =" idx r_idx) + (if (.i64_=# idx r_idx) g!output g!_))))) list#conjoint)]] @@ -5001,7 +4911,7 @@ pattern (|> tags enumeration (list#each (function (_ [tag_idx tag]) - (if ("lux i64 =" my_tag_index tag_idx) + (if (.i64_=# my_tag_index tag_idx) g!output g!_))) tuple$) @@ -5208,13 +5118,13 @@ r_var)))) list#conjoint) idx (if right? - (is Nat ("lux i64 +" 1 lefts)) + (is Nat (.i64_+# 1 lefts)) lefts) output (|> pattern' (list#each (is (-> [Symbol Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) (list (symbol$ r_slot_name) - (if ("lux i64 =" idx r_idx) + (if (.i64_=# idx r_idx) value r_var))))) list#conjoint)]] @@ -5293,13 +5203,13 @@ r_var)))) list#conjoint) idx (if right? - (is Nat ("lux i64 +" 1 lefts)) + (is Nat (.i64_+# 1 lefts)) lefts) output (|> pattern' (list#each (is (-> [Symbol Nat Code] (List Code)) (function (_ [r_slot_name r_idx r_var]) (list (symbol$ r_slot_name) - (if ("lux i64 =" idx r_idx) + (if (.i64_=# idx r_idx) (` ((, fun) (, r_var))) r_var))))) list#conjoint)]] @@ -5349,7 +5259,7 @@ [bindings' (monad#each maybe#monad symbol_short bindings) data' (monad#each maybe#monad tuple_list data)] (let [num_bindings (list#size bindings')] - (if (every? (|>> ("lux i64 =" num_bindings)) + (if (every? (|>> (.i64_=# num_bindings)) (list#each list#size data')) (let [apply (is (-> Replacement_Environment (List Code)) (function (_ env) (list#each (realized_template env) templates)))] @@ -5373,8 +5283,8 @@ (-> (I64 s) (I64 s))) (|>> ( 1)))] - [++ "lux i64 +"] - [-- "lux i64 -"] + [++ .i64_+#] + [-- .i64_-#] ) (def (interleaved xs ys) @@ -5445,11 +5355,10 @@ {#None} (failure (..wrong_syntax_error (symbol ..loop))))) init_types (monad#each meta#monad type_definition inits') expected ..expected_type] - (meta#in (list (` (("lux type check" - (-> (,* (list#each type_code init_types)) - (, (type_code expected))) - (function ((, name) (,* vars)) - (, body))) + (meta#in (list (` ((.is# (-> (,* (list#each type_code init_types)) + (, (type_code expected))) + (function ((, name) (,* vars)) + (, body))) (,* inits)))))) (do meta#monad [aliases (monad#each meta#monad @@ -5525,7 +5434,7 @@ (def .public (same? reference sample) (All (_ a) (-> a a Bit)) - ("lux is" reference sample)) + (.is?# reference sample)) (def .public as_expected (macro (_ tokens) @@ -5533,7 +5442,8 @@ (list expr) (do meta#monad [type ..expected_type] - (in (list (` ("lux type as" (, (type_code type)) (, expr)))))) + (in (list (` (.as# (, (type_code type)) + (, expr)))))) _ (failure (..wrong_syntax_error (symbol ..as_expected)))))) @@ -5548,8 +5458,8 @@ (do meta#monad [location location .let [[module line column] location - location (all "lux text concat" (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) - message (all "lux text concat" "Undefined behavior @ " location)]] + location (all .text_composite# (text#encoded module) "," (nat#encoded line) "," (nat#encoded column)) + message (all .text_composite# "Undefined behavior @ " location)]] (in (list (` (..panic! (, (text$ message))))))) _ @@ -5629,8 +5539,8 @@ (macro (_ tokens compiler) (when tokens (list [_ {#Text input}]) - (if (|> input "lux text size" ("lux i64 =" 1)) - (|> input ("lux text char" 0) + (if (|> input .text_size# (.i64_=# 1)) + (|> input (.text_char# 0) nat$ list [compiler] {#Right}) {#Left (..wrong_syntax_error (symbol ..char))}) @@ -5851,9 +5761,8 @@ (list expression) (do meta#monad [g!_ (..generated_symbol "g!_")] - (in (list (` ("lux try" - (.function ((, g!_) (, g!_)) - (, expression))))))) + (in (list (` (.try# (.function ((, g!_) (, g!_)) + (, expression))))))) _ (..failure (..wrong_syntax_error (symbol ..try)))))) @@ -5861,7 +5770,7 @@ (def (methodP tokens) (-> (List Code) (Maybe [(List Code) [Text Code]])) (when tokens - (list#partial [_ {#Form (list [_ {#Text "lux type check"}] + (list#partial [_ {#Form (list [_ {#Symbol [..prelude "is#"]}] type [_ {#Symbol ["" name]}])}] tokens') -- cgit v1.2.3