DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Option类型的实现方法比较


Scala的Option类型定义在 scala/scala的src/library/scala/Option.scala中:

sealed abstract class Option[+A]
final case class Some[+A](x: A) extends Option[A]
case object None extends Option[Nothing]

对应的Haskell定义是: data Maybe a = Nothing | Just a



Published

Apr 19, 2016

Last Updated

Apr 19, 2016

Category

Tech

Tags

  • haskell 11
  • maybe 1
  • option 2
  • scala 20

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor