3 ms·
It looks like a big improvement but it's definitely not monadic. It's a hidden return.
by millstone 7y ago
It looks like a big improvement but it's definitely not monadic. It's a hidden return.
- butterisgood 7y agoIf you sequence (>>=) a series of Maybe's in Haskell you have hidden returns as well. Since we're talking about the application of "bind" you could think of the "invisible semicolon" in Go as the same kind of bind between "try" statements in Go, and get very similar behaviors - conceptually. At least, that's how I think I've understood "try" to work. (pseudocode... ) f := try(open(...)) num_bytes := try(write_some_bytes(f, ...)) I hope my function bailed out early at "f := try(open(...))" because the line "num_bytes..." literally makes no sense at all if f hasn't been even declared "f :=" vs "f =". In the end, if I don't like it, I don't have to use it, but I still have to understand it if it's in the language and I'm reading other people's code.