All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freedsl.io.IO.scala Maven / Gradle / Ivy

The newest version!
package freedsl.io

import freedsl.dsl._

object IO {

  def interpreter = new Interpreter {
    def run[A](f: () => A)(implicit context: Context) = util.Try(f()) match {
      case util.Success(s) => success(s)
      case util.Failure(t) => failure(IOError(t))
    }
  }

  case class IOError(t: Throwable) extends Error

}

@dsl trait IO[M[_]] {
  def run[A](f: () => A): M[A]
  def apply[A](f: => A) = run(() => f)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy