From 43fcb615fba98c1d52fe513a618cc4235cb77208 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Tue, 15 Aug 2023 21:42:04 -0600 Subject: [PATCH] Remove dynamic bindings from strawman Instead, I'm going to eventually try adding impredicativity with Quick Look, so I can use records as modules and use one to pass effectful library funcs to the entry point. --- strawman4.txt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/strawman4.txt b/strawman4.txt index 9f2289c..2683fff 100644 --- a/strawman4.txt +++ b/strawman4.txt @@ -1,6 +1,3 @@ -# v5 -# Added implicit (dynamic) bindings - # v4 # Moved type annotations into bindings. # Added def keyword for top-level bindings. @@ -33,8 +30,6 @@ type alias tree 'a = recurse 'T in type alias unit = {} -implicit print(s: string) -> unit - # Type aliases should appear in compiler messages. # binary_tree takes a comparison function and returns a record (like a JS # object) as a module for handling binary trees of values of the same type @@ -43,7 +38,7 @@ def binary_tree(compare: fn('a) -> 'a) -> { empty: tree 'a, insert: fn(tree 'a, 'a) -> tree 'a, find: fn(tree 'a, 'a) -> maybe 'a, - @"func we don't care about": fn() -> |print| unit + @"func we don't care about": fn() -> unit } = # A let expression can bind multiple names. Functions have access to all names within the expression, # while other values only have access to names bound before them. @@ -70,7 +65,7 @@ def binary_tree(compare: fn('a) -> 'a) -> { in {empty, insert, find, @"func we don't care about"} # Prints "`some(2)". -def do_tree_things() -> |print| unit = +def do_tree_things() = # Assume that int_compare is in the stdlib or something. let {insert, empty, find | @"stuff we don't need"} = binary_tree(int_compare) # I invented this fancy partial-application syntax with _, and then found @@ -81,7 +76,7 @@ def do_tree_things() -> |print| unit = @"stuff we don't need" # Prints "`some(2)\nignore me". -def main() = with print = native_print in do_tree_things().@"func we don't care about"() +def main() = do_tree_things().@"func we don't care about"() def annotate(note: 'a, obj: {|'b}) -> {note: 'a | 'b} = { note | obj } @@ -93,4 +88,4 @@ def reannotate(note: 'a, obj: {note: 'a | 'b}) -> {note: 'a | 'b} = def map(f: fn('a) -> 'b, xs: ['a]) -> ['b] = crash("TODO") -def doubled = let double(n) = 2 * n in map(double, [1,2,3,4,5]) +def doubled = let double(n) = 2 * n in map(double, [1,2,3,4,5]) \ No newline at end of file