Skip to content

Commit

Permalink
fix(std): return maybe as base type for now
Browse files Browse the repository at this point in the history
emil14 committed Jan 11, 2025
1 parent 1893d76 commit 34d351c
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 6 additions & 4 deletions examples/fizzbuzz/main.neva
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@ import {
}

def Main(start any) (stop any) {
map_fb Map<int, FizzBuzzResult>{FizzBuzz}
for_print For{fmt.Println<FizzBuzzResult>}
map_fb Map<int, any>{FizzBuzz}
for_print For{fmt.Println<any>}
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<FizzBuzzResult>
def FizzBuzz(data int) (res any) {
select Select<any>
mod15 Mod15
mod3 Mod3
mod5 Mod5

---

:data -> [mod15, select:then[3]]

mod15:then -> select:if[0]
2 changes: 1 addition & 1 deletion examples/hello_world/main.neva
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fmt }

def Main(start any) (stop any) {
fmt.Println
println fmt.Println<string>
---
:start -> 'Hello, World!' -> println -> :stop
}
6 changes: 1 addition & 5 deletions std/builtin/types.neva
Original file line number Diff line number Diff line change
@@ -5,11 +5,7 @@ pub type float
pub type string
pub type dict<T>
pub type list<T>

pub type maybe<T> union {
some T
none
}
pub type maybe<T> // TODO consider using union

pub type error struct {
text string

0 comments on commit 34d351c

Please sign in to comment.