diff --git a/examples/hello-world/src/main.lm b/examples/hello-world/src/main.lm index e94a075..464388a 100644 --- a/examples/hello-world/src/main.lm +++ b/examples/hello-world/src/main.lm @@ -1,4 +1,4 @@ use std:io fn main = - io:println ("Hello" <++> " " <++> "World!") + io:println ("Hello" <> " " <> "World!") diff --git a/examples/maybe-implementation/src/main.lm b/examples/maybe-implementation/src/main.lm index 90bf8b6..a1a7941 100644 --- a/examples/maybe-implementation/src/main.lm +++ b/examples/maybe-implementation/src/main.lm @@ -26,7 +26,7 @@ impl ToString for Maybe a fn show m as self -> string = match m | Nothing -> "Nothing" - | Just a -> "Just " <++> show a + | Just a -> "Just " <> show a fn main = Just 5 diff --git a/examples/modules/src/main.lm b/examples/modules/src/main.lm index ea52ec5..4a9fa14 100644 --- a/examples/modules/src/main.lm +++ b/examples/modules/src/main.lm @@ -3,8 +3,8 @@ use other_dir [world] // using a directory will refer to the `lib.lm` file use other_dir:file [Color [..], Direction [Right, Down]] fn main = - do file:print (hello <++> world) - then file:print (other_file:hello <++> project:other_dir:world) + do file:print (hello <> world) + then file:print (other_file:hello <> project:other_dir:world) fn allowed as (Color, Direction) = (Green, Down) diff --git a/examples/tuples/src/main.lm b/examples/tuples/src/main.lm index 55f0a17..a35914d 100644 --- a/examples/tuples/src/main.lm +++ b/examples/tuples/src/main.lm @@ -5,4 +5,4 @@ fn main = print_user user fn print_user (name, age) as (string, int) -> () = - io:println (name <++> " " <++> show age) + io:println (name <> " " <> show age) diff --git a/luminapath/std/io/lib.lm b/luminapath/std/io/lib.lm index 5ad90df..1fcf120 100644 --- a/luminapath/std/io/lib.lm +++ b/luminapath/std/io/lib.lm @@ -18,7 +18,7 @@ pub fn print str as s -> () = @[platform "linux"] when s can ToString pub fn println str as s -> () = - let {ptr, len} = (show str <++> "\n") . toByteVec in + let {ptr, len} = (str <> "\n") . toByteVec in do libc:write stdout ptr (len as int) then () diff --git a/luminapath/std/list/lib.lm b/luminapath/std/list/lib.lm index 7829a5e..566b953 100644 --- a/luminapath/std/list/lib.lm +++ b/luminapath/std/list/lib.lm @@ -162,13 +162,13 @@ pub fn split_at at list as uint, List a -> (List a, List a) = when a can ToString impl ToString for [a] fn show list as [a] -> string = - "[" <++> show_ list + "[" <> show_ list where fn show_ list as [a] -> string = match list | [] -> "]" - | [last] -> show last <++> "]" - | [x : xs] -> show x <++> ", " <++> show_ xs + | [last] -> show last <> "]" + | [x : xs] -> show x <> ", " <> show_ xs // TODO: Considder splitting equality out from Compare diff --git a/luminapath/std/list/slice.lm b/luminapath/std/list/slice.lm index 84a0e42..05075c5 100644 --- a/luminapath/std/list/slice.lm +++ b/luminapath/std/list/slice.lm @@ -75,12 +75,12 @@ pub fn to_list slice as Slice a -> List a = when a can ToString impl ToString for Slice a fn show slice as self -> string = - "[" <++> show_ slice + "[" <> show_ slice where fn show_ slice as Slice a -> string = match split slice | Nothing -> "]" | Just (x, xs) -> if xs.len == 0 - then show x <++> "]" - else show x <++> ", " <++> show_ xs + then show x <> "]" + else show x <> ", " <> show_ xs diff --git a/luminapath/std/list/vec.lm b/luminapath/std/list/vec.lm index b76f15f..7d15092 100644 --- a/luminapath/std/list/vec.lm +++ b/luminapath/std/list/vec.lm @@ -3,7 +3,7 @@ use std:list [Listable] use std:list:slice [Slice] use std:math [Compare [>=]] use std:io [crash] -use std:string [<++>] +use std:string [<>] // An immutable heap-allocated array pub type Vec a { @@ -37,7 +37,7 @@ pub fn unsafe_set i v {ptr, len} as uint, a, Vec a -> () = pub fn from_range (start, end) f as (uint, uint), fn(uint -> a) -> Vec a = if start > end then - crash ("error: from_range end larger than start " <++> show end <++> " > " <++> show start) + crash ("error: from_range end larger than start " <> end <> " > " <> start) else let count = (end - start) in let vec = capacity count in diff --git a/luminapath/std/math/lib.lm b/luminapath/std/math/lib.lm index 525b46d..3077acc 100644 --- a/luminapath/std/math/lib.lm +++ b/luminapath/std/math/lib.lm @@ -1,4 +1,5 @@ pub use non_zero [NonZero] +use std:string [<+>] use std:io [crash] when n can Num + Negate + Compare @@ -59,13 +60,13 @@ pub trait Compare when a can ToString fn or_overflow_error char lhs rhs (n, overflown) as u8, a, a, (a, bool) -> a = if overflown - then crash ("integer overflow " <++> show lhs <++> " " <+> char <++> " " <++> show rhs) + then crash ("integer overflow " <> lhs <> " " <+> char <> " " <> show rhs) else n when a can ToString fn or_underflow_error char lhs rhs (n, underflown) as u8, a, a, (a, bool) -> a = if underflown - then crash ("integer underflow " <++> show lhs <++> " " <+> char <++> " " <++> show rhs) + then crash ("integer underflow " <> lhs <> " " <+> char <> " " <> rhs) else n impl Num for u8 diff --git a/luminapath/std/prelude/lib.lm b/luminapath/std/prelude/lib.lm index a35a78f..7495a64 100644 --- a/luminapath/std/prelude/lib.lm +++ b/luminapath/std/prelude/lib.lm @@ -9,7 +9,7 @@ pub use std:math:i32 pub use std:math:i64 pub use std:maybe [Maybe [..]] pub use std:result [Result [..]] -pub use std:string [string, ToString [show], <:>, <++>, <+>] +pub use std:string [string, ToString [show], <>] pub use std:list [Listable [:], List, ++] use std:string [Stringable] pub use std:nothing [nothing] diff --git a/luminapath/std/result/lib.lm b/luminapath/std/result/lib.lm index b6be80e..3422565 100644 --- a/luminapath/std/result/lib.lm +++ b/luminapath/std/result/lib.lm @@ -21,7 +21,7 @@ when e can ToString pub fn or_crash msg r as string, Result a e -> a = match r | Ok v -> v - | Err err -> io:crash (msg <++> ": " <++> show err) + | Err err -> io:crash (msg <> ": " <> show err) pub fn or_crash_ msg r as string, Result a e -> a = match r diff --git a/luminapath/std/string/lib.lm b/luminapath/std/string/lib.lm index 61c6d3f..e99f7f9 100644 --- a/luminapath/std/string/lib.lm +++ b/luminapath/std/string/lib.lm @@ -83,6 +83,12 @@ pub fn to_c_str str as string -> *u8 = pub trait ToString fn show as self -> string +when + a can ToString + b can ToString +pub fn <> left right as a, b -> string = + show left <++> show right + pub fn <:> left right as u8, string -> string = { string | inner = left : right.inner } diff --git a/luminapath/std/string/num.lm b/luminapath/std/string/num.lm index 02678da..25fd0ff 100644 --- a/luminapath/std/string/num.lm +++ b/luminapath/std/string/num.lm @@ -1,3 +1,5 @@ +use std:string [<:>, <+>] + impl ToString for i64 fn show n = let str = show ((std:math:i64:abs n) as u64) in diff --git a/luminapath/std/tuple/lib.lm b/luminapath/std/tuple/lib.lm index 6c91792..d75cf24 100644 --- a/luminapath/std/tuple/lib.lm +++ b/luminapath/std/tuple/lib.lm @@ -1,9 +1,13 @@ +use std:string [<++>] + +// TODO: using `<>` instead of `<++>` here causes bools to display as ints. +// That does not make any sense, and must be some sort of problem with our trait solver? when a can ToString b can ToString impl ToString for (a, b) fn show (a, b) as (a, b) -> string = - "(" <++> show a <++> ", " <++> show b <++> ")" + "(" <++> show a <++> show ", " <++> show b <++> show ")" when a can ToString @@ -11,7 +15,7 @@ when c can ToString impl ToString for (a, b, c) fn show (a, b, c) as (a, b, c) -> string = - "(" <++> show a <++> ", " <++> show b <++> ", " <++> show c <++> ")" + "(" <++> show a <++> show ", " <++> show b <++> show ", " <++> show c <++> show ")" when a can ToString @@ -20,7 +24,7 @@ when d can ToString impl ToString for (a, b, c, d) fn show (a, b, c, d) as (a, b, c, d) -> string = - "(" <++> show a <++> ", " <++> show b <++> ", " <++> show c <++> ", " <++> show d <++> ")" + "(" <++> show a <++> show ", " <++> show b <++> show ", " <++> show c <++> show ", " <++> show d <++> show ")" when a can ToString @@ -30,7 +34,7 @@ when e can ToString impl ToString for (a, b, c, d, e) fn show (a, b, c, d, e) as (a, b, c, d, e) -> string = - "(" <++> show a <++> ", " <++> show b <++> ", " <++> show c <++> ", " <++> show d <++> ", " <++> show e <++> ")" + "(" <++> show a <++> show ", " <++> show b <++> show ", " <++> show c <++> show ", " <++> show d <++> show ", " <++> show e <++> show ")" when a can ToString @@ -41,4 +45,4 @@ when f can ToString impl ToString for (a, b, c, d, e, f) fn show (a, b, c, d, e, f) as (a, b, c, d, e, f) -> string = - "(" <++> show a <++> ", " <++> show b <++> ", " <++> show c <++> ", " <++> show d <++> ", " <++> show e <++> ", " <++> show f <++> ")" + "(" <++> show a <++> show ", " <++> show b <++> show ", " <++> show c <++> show ", " <++> show d <++> show ", " <++> show e <++> show ", " <++> show f <++> show ")"