turbine: Return value is not chained?
I was expecting both elements to show up but only first one did:
function* main() {
yield label('Please enter your name:')
return input()
}
It does show up when I remove the yield:
function* main() {
return input()
}
A bug or feature? 😃
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (16 by maintainers)
No, It is not the list/array monad. According to Jabz documentation,
find
returns aMaybe<A>
which is either ajust a
ornothing
. This makes sense, since searching for something in a list, will only maybe give you a result otherwise nothing.Chaining a Maybe is like saying: “Calculate this unless you get a
nothing
, in that case, the whole result isnothing
” sincego
-notation is just sugar for calling chain, the example returnsnothing
if any of the yielded functions returnsnothing
otherwise it returnsjust d
whered
is the result of the computation.yes, this is correct.
it means that if
main
were made to a Component usinggo
-notation, running/yielding this component would return{}
.