Skip to content

Commit

Permalink
refactor(examples)
Browse files Browse the repository at this point in the history
  • Loading branch information
emil14 committed Feb 4, 2024
1 parent 73c2acb commit bac3863
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
18 changes: 9 additions & 9 deletions examples/3_interfaces/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
// It's essential to understand bridges.

interfaces {
IExample<T>(msg T) (msg T)
IExample<T>(data T) (sig T)
}

components {
Main(enter any) (exit any) {
nodes {
sub SubComponent {
dep Printer<any>
subNode SecondComponent {
depNode Printer<any>
}
}
net {
in:enter -> sub:msg
sub:msg -> out:exit
in:enter -> subNode:msg
subNode:msg -> out:exit
}
}

SubComponent (msg any) (msg any) {
SecondComponent (msg any) (msg any) {
nodes {
dep IExample<any>
depNode IExample<any>
}
net {
in:msg -> dep:msg
dep:msg -> out:msg
in:msg -> depNode:data
depNode:sig -> out:msg
}
}
}
8 changes: 4 additions & 4 deletions examples/6_struct_builder/with_sugar/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ components {
print Print<User>
}
net {
32 -> builder.age
'John' -> builder.name
builder.v -> print.v
print.v -> out:exit
32 -> builder:age
'John' -> builder:name
builder:msg -> print:data
print:sig -> out:exit
}
}
}
5 changes: 3 additions & 2 deletions examples/7_struct_selector/verbose/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ types {

const {
user User {
name: 'john'
pet: { name: 'Charley' }
name: 'John',
pet: { name: 'Charley' },
}
path list<string> ['pet', 'name']
}
Expand All @@ -23,6 +23,7 @@ components {
Main(enter any) (exit any) {
nodes {
printer Printer<string>

#runtime_func_msg(path)
selector StructSelector<string>
}
Expand Down
4 changes: 2 additions & 2 deletions examples/7_struct_selector/with_selectors/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ types {
}

const {
u User {
user User {
age: 32
name: 'john'
}
Expand All @@ -22,7 +22,7 @@ components {
printer Printer<string>
}
net {
in:enter -> ($u.pet.name -> printer:msg)
in:enter -> ($user.pet.name -> printer:msg)
printer:msg -> out:exit
}
}
Expand Down
1 change: 1 addition & 0 deletions std/builtin/base.neva
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ types {
pub list<T>

pub stream<T> maybe<T>

pub error struct {
text string
child maybe<error>
Expand Down
2 changes: 1 addition & 1 deletion std/builtin/bridges.neva
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// they serve as adapters for stream handlers and outside world:

interfaces {
IStreamHandler<T>(seq stream<T>) (res T)
pub IStreamHandler<T>(seq stream<T>) (res T)
}

components {
Expand Down

0 comments on commit bac3863

Please sign in to comment.