4 ms·
I often wonder how the "tool" named MONADS could help to deal with this quite old problem of what I call meta-types or semantic types (i'm sure there is a pro
by pointernil 13y ago
I often wonder how the "tool" named MONADS could help to deal with this quite old problem of what I call
meta-types or semantic types
(i'm sure there is a proper name for this; I'm not a cs/type-theory professional ;)
Time handling f.e. and often physical Units would quite often benefit from much stronger guaranties at compile and runtime. And no, OOP and it's tools are not sufficient to handle this... in theory maybe, not in day to day development.
We need to translate the core ideas of a monad into more a "mainstream" syntax and runtime env. to prevent the next incident of:
I'll just add the integer 365 to my certificate valid-date within our core cloud infrastructure code...
I'm not necessarily a MS fan, but would love to see how Anders Hejlsberg f.e. would tackle this kind of language-design challenge ;)
- tel 13y agoI don't think this has much at all to do with monads.
- pointernil 13y agoCare to explain in a little more detail? Is a calender resp. date-time monad really such a far fetched idea?
- tel 13y agoThat's just a state monad, the thread and what I assumed and may have assumed incorrectly you were talking about, was around overloading math operations to work on dimensionalized quantities like feet and seconds and the like. You can dimensionalize time as well—take a look at the time or thyme Haskell packages for some fascinating examples. Doing computation in the context of the current time is absolutely monadic. If you're handling time abstractly, it's the state monad. If you're handling it for real then you need some kind of monad protecting communication with NTP/your local CPU clock. That's IO in Haskell.
- pointernil 13y agoYup, you assumed incorrectly. I can see the qualitative difference between operator overloading and monads. That's why I suggested to transfer the core idea of monads into more mainstream languages to provide more "semantic" safety, so to say. Thanks for the clarification.