From 34d351c60b41b8f487a3c2bc68b337be9f181cf9 Mon Sep 17 00:00:00 2001 From: Emil Valeev Date: Sun, 12 Jan 2025 03:00:44 +0500 Subject: [PATCH] fix(std): return maybe as base type for now --- examples/fizzbuzz/main.neva | 10 ++++++---- examples/hello_world/main.neva | 2 +- std/builtin/types.neva | 6 +----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/examples/fizzbuzz/main.neva b/examples/fizzbuzz/main.neva index 3c7bdc33..9274215b 100644 --- a/examples/fizzbuzz/main.neva +++ b/examples/fizzbuzz/main.neva @@ -3,8 +3,8 @@ import { } def Main(start any) (stop any) { - map_fb Map{FizzBuzz} - for_print For{fmt.Println} + map_fb Map{FizzBuzz} + for_print For{fmt.Println} wait Wait --- :start -> 1..101 -> map_fb -> for_print -> wait -> :stop @@ -15,12 +15,14 @@ type FizzBuzzResult union { String string } -def FizzBuzz(data int) (res FizzBuzzResult) { - select Select +def FizzBuzz(data int) (res any) { + select Select mod15 Mod15 mod3 Mod3 mod5 Mod5 + --- + :data -> [mod15, select:then[3]] mod15:then -> select:if[0] diff --git a/examples/hello_world/main.neva b/examples/hello_world/main.neva index 971802cd..0b448b01 100644 --- a/examples/hello_world/main.neva +++ b/examples/hello_world/main.neva @@ -1,7 +1,7 @@ import { fmt } def Main(start any) (stop any) { - fmt.Println + println fmt.Println --- :start -> 'Hello, World!' -> println -> :stop } diff --git a/std/builtin/types.neva b/std/builtin/types.neva index 6d6669fd..39cf60e5 100644 --- a/std/builtin/types.neva +++ b/std/builtin/types.neva @@ -5,11 +5,7 @@ pub type float pub type string pub type dict pub type list - -pub type maybe union { - some T - none -} +pub type maybe // TODO consider using union pub type error struct { text string