4 ms·
a draft of the RFC contains an example: https://github.com/Crell/enum-comparison/blob/master/rfc.md#maybe https://github.com/Crell/enum-comparison/blob/master/r
by beberlei 6y ago
a draft of the RFC contains an example: https://github.com/Crell/enum-comparison/blob/master/rfc.md#maybe https://github.com/Crell/enum-comparison/blob/master/rfc.md#... - I would agree with you that using monad as a term here confuses much more than convinces of the feature.
- zaphar 6y agoThe draft there has a feature that the posted RFC does not. Associated types. Without the associated types you can't have the monadic style behavior which is why I was similarly confused by that wording there. Associated types elevates this from "Oh look a C enum" to actually useful ADT's like in Rust or the ML family of languages. I wonder if the draft you linked will make it into the official rfc or not.
- tored 6y agoThere is meta RFC for enums https://wiki.php.net/rfc/adts https://wiki.php.net/rfc/adts That links to this rfc https://wiki.php.net/rfc/tagged_unions https://wiki.php.net/rfc/tagged_unions