probability_monad.TryDistributions.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cps-async-connect-probabiliy-monad_3 Show documentation
Show all versions of cps-async-connect-probabiliy-monad_3 Show documentation
cps-async-connect: integration of dotty-cps-async with effect stacks
The newest version!
package probability_monad
import scala.util.Try
class MapTryDistribution[A,B](fa:Distribution[A],f:Try[A] => B) extends Distribution[B] {
override def get: B = {
f(Try(fa.get))
}
}
class FlatMapTryDistribution[A,B](fa:Distribution[A],f:Try[A] => Distribution[B]) extends Distribution[B] {
override def get: B = {
f(Try(fa.get)).get
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy