タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

Scalaに関するminodiskのブックマーク (2)

  • learning Scalaz — \/

    \/ LYAHFGG: The Either e a type on the other hand, allows us to incorporate a context of possible failure to our values while also being able to attach values to the failure, so that they can describe what went wrong or provide some other useful info regarding the failure. We know Either[A, B] from the standard library, but Scalaz 7 implements its own Either equivalent named \/: sealed trait \/[+A

    minodisk
    minodisk 2018/12/25
    びっくりシリーズ
  • Implicitには型注釈をつけましょう - OE_uia Tech Blog

    Scalaには(とても今更ですが) Implicit/暗黙 というキーワードがあります。Implicitキーワードを宣言する場所をざっくり分けると、以下の4つ。 1) implicit class … 2) implicit parameter (e.g. (implicit a:A) ) 3) implicit def … 4) implicit (var | val) … この中で1,2は(明示的に)型を書かざるを得ませんが、3のdefの戻り値、及び4については、型注釈を明示的に書かずに型推論を働かせることが(少なくとも最新の2.11.7でも)可能です。 しかし型注釈を書かなかった場合、以下のような(一見理由の分かりにくい)コンパイルエラーに遭遇する可能性が有ることはご存知でしょうか? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 //compile success

  • 1