Last active
February 22, 2016 00:30
-
-
Save bkovitz/65935cd68b2be59f093e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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