Skip to content

Instantly share code, notes, and snippets.

@bkovitz
Last active February 22, 2016 00:30
Show Gist options
  • Save bkovitz/65935cd68b2be59f093e to your computer and use it in GitHub Desktop.
Save bkovitz/65935cd68b2be59f093e to your computer and use it in GitHub Desktop.
trait CanBoost[S, D] extends D => D => State[S, Unit]
def boost[S, D](from: D, to: D)(implicit run: CanBoost[S, D]): State[S, Unit] =
run(from)(to)
trait GetValueFunc[S, D, V] extends D => State[S, Option[ValueFunc[V]]]
def invalues[S, D, V](d: D)
(implicit getValueFunc: GetValueFunc[S, D, V],
officialPartner: GetOfficialPartner[S, D],
outvalue: GetOutvalue[S, D])
: State[S, Seq[Option[V]]] =
ifDefinedElseS(getValueFunc(d))
{ vfunc => mapS(vfunc.sources) { sources =>
ifDefinedS(officialPartner(d))
{ supplyDock => outvalue(supplyDock) }
} }
{ unitS(Seq.empty) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment