3 ms·
I'm not sure about that. Scala's Option monad is just a class in the standard library, not a language feature. http://www.scala-lang.org/api/current/index.htm
by saryant 13y ago
I'm not sure about that. Scala's Option monad is just a class in the standard library, not a language feature.
http://www.scala-lang.org/api/current/index.html#scala.Option http://www.scala-lang.org/api/current/index.html#scala.Optio...
- Mithaldu 13y agoI'll be honest, i have no idea what any of the stuff written on that page means. Can you show me the implementation of that class in pure Scala code?
- saryant 13y agoHere's the implementation: https://github.com/scala/scala/blob/v2.10.3/src/library/scala/Option.scala#L1 https://github.com/scala/scala/blob/v2.10.3/src/library/scal... (FYI, many Scaladocs have links back to the code on Github)
- Mithaldu 13y agoAlright, so it really is just a Scala class with some handy shortcuts. Please do note though that the docs you linked do not think it is a monad, just that it's easy to think of it as one. Edit: In fact, it kinda smells like how Perl works when you do this: no warnings 'undefined';
- frowaway001 13y ago> Please do note though that the docs you linked do not think it is a monad, just that it's easy to think of it as one. Heh?