mirror of
https://github.com/fluencelabs/codec
synced 2025-04-27 15:52:13 +00:00
Compare commits
No commits in common. "master" and "0.0.5" have entirely different histories.
@ -49,7 +49,6 @@ abstract class MonadicalEitherArrow[E <: Throwable] {
|
|||||||
* @tparam B Successful result type
|
* @tparam B Successful result type
|
||||||
*/
|
*/
|
||||||
abstract class Func[A, B] {
|
abstract class Func[A, B] {
|
||||||
f ⇒
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run the func on input, using the given monad.
|
* Run the func on input, using the given monad.
|
||||||
@ -77,30 +76,6 @@ abstract class MonadicalEitherArrow[E <: Throwable] {
|
|||||||
*/
|
*/
|
||||||
def apply[F[_]: Monad](input: A): EitherT[F, E, B]
|
def apply[F[_]: Monad](input: A): EitherT[F, E, B]
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortcut for function composition
|
|
||||||
*
|
|
||||||
* @param other Other function to run after
|
|
||||||
* @tparam C Resulting input type
|
|
||||||
* @return Composed function
|
|
||||||
*/
|
|
||||||
def on[C](other: Func[C, A]): Func[C, B] =
|
|
||||||
catsMonadicalEitherArrowChoice.compose(this, other)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert this Func into another one, lifting the error
|
|
||||||
*
|
|
||||||
* @param m Another instance of MonadicalEitherArrow
|
|
||||||
* @param convertE Convert error
|
|
||||||
* @tparam EE Error type
|
|
||||||
* @return Converted function
|
|
||||||
*/
|
|
||||||
def to[EE <: Throwable](m: MonadicalEitherArrow[EE])(implicit convertE: E ⇒ EE): m.Func[A, B] =
|
|
||||||
new m.Func[A, B] {
|
|
||||||
override def apply[F[_]: Monad](input: A): EitherT[F, EE, B] =
|
|
||||||
f[F](input).leftMap(convertE)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts this Func to Kleisli, using MonadError to execute upon and to lift errors into.
|
* Converts this Func to Kleisli, using MonadError to execute upon and to lift errors into.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user