| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (MonadCatchIOSyntax.scala)

This example Scala source code file (MonadCatchIOSyntax.scala) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Scala by Example" TM.

Learn more about this Scala project at its project page.

Java - Scala tags/keywords

monadcatchio, monadcatchioops, option, resource, throwable, tomonadcatchioops, tomonadcatchioops0, tomonadcatchioopsunapply

The MonadCatchIOSyntax.scala Scala example source code

package scalaz
package syntax
package effect

import scalaz.effect.MonadCatchIO
import scalaz.effect.Resource

/** Wraps a value `self` and provides methods related to `MonadCatchIO` */
sealed abstract class MonadCatchIOOps[F[_],A] extends Ops[F[A]] {
  implicit def F: MonadCatchIO[F]
  def except(handler: Throwable => F[A]): F[A] = F.except(self)(handler)
  def catchSome[B](p: Throwable => Option[B], handler: B => F[A]): F[A] = MonadCatchIO.catchSome(self)(p, handler)
  def catchLeft: F[Throwable \/ A] = MonadCatchIO.catchLeft(self)
  def catchSomeLeft[B](p: Throwable => Option[B]): F[B \/ A] = MonadCatchIO.catchSomeLeft(self)(p)
  def onException[B](action: F[B]): F[A] = MonadCatchIO.onException(self, action)
  def bracket[B, C](after: A => F[B])(during: A => F[C]): F[C] =
  def ensuring[B](sequel: F[B]): F[A] = MonadCatchIO.ensuring(self, sequel)
  def bracket_[B, C](after: F[B])(during: F[C]): F[C] =
  def bracketOnError[B, C](after: A => F[B])(during: A => F[C]): F[C] =
  def using[B](f: A => F[B])(implicit resource: Resource[A]) = MonadCatchIO.using(self)(f)

sealed trait ToMonadCatchIOOps0 {
  implicit def ToMonadCatchIOOpsUnapply[FA](v: FA)(implicit F0: Unapply[MonadCatchIO, FA]) =
    new MonadCatchIOOps[F0.M,F0.A] { def self = F0(v); implicit def F: MonadCatchIO[F0.M] = F0.TC }


trait ToMonadCatchIOOps extends ToMonadCatchIOOps0 {
  implicit def ToMonadCatchIOOps[F[_],A](v: F[A])(implicit F0: MonadCatchIO[F]) =
    new MonadCatchIOOps[F,A] { def self = v; implicit def F: MonadCatchIO[F] = F0 }



trait MonadCatchIOSyntax[F[_]] {
  implicit def ToMonadCatchIOOps[A](v: F[A])(implicit F0: MonadCatchIO[F]): MonadCatchIOOps[F, A] = new MonadCatchIOOps[F,A] { def self = v; implicit def F: MonadCatchIO[F] = F0 }



Other Scala examples (source code examples)

Here is a short list of links related to this Scala MonadCatchIOSyntax.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.