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,
findreturns aMaybe<A>which is either ajust aornothing. 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 returnsnothingif any of the yielded functions returnsnothingotherwise it returnsjust dwheredis the result of the computation.yes, this is correct.
it means that if
mainwere made to a Component usinggo-notation, running/yielding this component would return{}.