Search code examples
scalacollectionsstyleslanguage-theory

Where did Option[T] come from in Scala?


I'm still a noob in Scala development but I have found the Option[T] concept really awesome, specially the pattern matching when used with Some and None. I am even implementing it so some extent in a C# project I'm working on at the moment, but as there is no pattern matching in there is isn't really that awesome.

The real question is, where is the theory behind this object? is it something specific from Scala? Funcional languages? Where can I find more about it?


Solution

  • Most of the time I was thinking that it comes from the Haskell, and has a name of Maybe monad

    But after a little research, I've found that there was some references on option types in SML papers, as @ShiDoiSi said. Moreover, it has the same semantics (Some/None) that Scala has. The elderest paper I was able to find is that (circa '89) (see footnote on the 6th page)