{"published":"2010-12-26 14:38:32","provider_name":"Hatena Blog","blog_title":"\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u30cd\u30bf\u5e33","height":"190","categories":["Scala"],"author_url":"https://blog.hatena.ne.jp/shomah4a/","description":"Option \u3092\u3042\u308c\u3053\u308c Scala \u306e Option \u306f Haskell \u306b\u304a\u3051\u308b Maybe \u3068\u5927\u4f53\u540c\u3058\u3067\u3042\u308b\u3002\u306a\u306e\u3067 class Maybe[T](opt: Option[T]) { def >>=[U](f:(T=>Option[U])) = opt flatMap f } implicit def optionToMaybe[T](opt: Option[T]) = new Maybe(opt) \u3068\u3044\u3046\u5b9a\u7fa9\u3092\u3057\u3066\u3042\u3052\u308c\u3070 def test(t:Int): Option[Int] = Some(10*t) val x = Some(10) println(x >>= test >>= \u2026","blog_url":"https://shomah4a.hatenadiary.org/","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshomah4a.hatenadiary.org%2Fentry%2F20101226%2F1293341912\" title=\" Maybe \u3068\u304b Option \u3068\u304b - \u30d7\u30ed\u30b0\u30e9\u30de\u306e\u30cd\u30bf\u5e33\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","url":"https://shomah4a.hatenadiary.org/entry/20101226/1293341912","version":"1.0","author_name":"shomah4a","type":"rich","provider_url":"https://hatena.blog","image_url":null,"title":" Maybe \u3068\u304b Option \u3068\u304b"}