Functional Programming Examples from Real Life

  def attack[Target <: OwnedObj]
  (obj: Target, world: World)(implicit log: LoggingAdapter)
  : Either[String, Evented[(World, Self, Attack, Option[Target])]]
  def attack[Target <: OwnedObj]
  (obj: Target, world: World)(implicit log: LoggingAdapter)
  : Either[String, Evented[(World, Option[Self], Attack, Option[Target])]]

After adding retaliation - a fighter might fire back if attacked. And the attacker might get destroyed.

Retaliation

FP Examples from real life

By Artūras Šlajus

FP Examples from real life

  • 871
Loading comments...

More from Artūras Šlajus