3 ms·
The Maybe Type and Its Consequences
- tel 17y agoThe author seems to be learning a lot from Haskell, but still unable to really accept the larger picture Fortress goes beyond Haskell in that the type Maybe[\T\] extends type Generator[\T\] so that it can be treated much like a set that will generate either one item or no items at all. One can conveniently use generator syntax to extract the contained item of a Maybe type, bind a variable to that value, and then execute a chunk of code---but only if there is in fact a contained item The following examples are both trivially available in Haskell as the very general monadic binding (>>=) or a case statement. It's great that other languages are learning powerful lessons that the strong typing in Haskell can teach, but if they're going to do it they might as well learn all that they can instead of stumbling down the same path again. I bet in no time Fortress will have do notation.