Skip to content

Releases: kevin-lee/effectie

v2.0.0-beta14

12 Jan 09:37
b3eac86
Compare
Choose a tag to compare

2.0.0-beta14 - 2024-01-12

New Feature

  • Add effectie-time module (#601)
  • [effectie-time] Add TimeSource (#602)
    TimeSource[F].currentTime()
    TimeSource[F].realTime
    TimeSource[F].realTimeTo
    TimeSource[F].monotonic
    TimeSource[F].monotonicTo
    TimeSource[F].timeSpent(F[A])
  • [effectie-time] Add ApproxFiniteDuration and syntax (#603)
    import scala.concurrent.duration._
    import effectie.time.syntax._
    
    5.seconds +- 2.seconds
    // ApproxFiniteDuration(5.seconds, 2.seconds)
    
    3.seconds.isWithIn(5.seconds +- 2.seconds)
    // Boolean = true
    
    7.seconds.isWithIn(5.seconds +- 2.seconds)
    // Boolean = true
    
    2.seconds.isWithIn(5.seconds +- 2.seconds)
    // Boolean = false
    
    8.seconds.isWithIn(5.seconds +- 2.seconds)
    // Boolean = false
  • Add effectie-cats-effect2-time effectie-time-cats-effect2 (#607)
  • [effectie-cats-effect2-time] Add TimeSource with Clock from cats-effect 2 (#608)
  • Add effectie-cats-effect3-time effectie-time-cats-effect3 (#610)
  • [effectie-cats-effect3-time] Add TimeSource with Clock from cats-effect 3 (#611)
  • Rename effectie-cats-effect2-time to effectie-time-cats-effect2 and effectie-cats-effect3-time to effectie-time-cats-effect3 (#615)

v2.0.0-beta13

30 Sep 15:41
58e7f93
Compare
Choose a tag to compare

2.0.0-beta13 - 2023-10-01

Changes

  • CanHandleError[Future] and CanRecover[Future] should use Future's recover and recoverWith. (#584)
  • CanHandleError[Try].handleNonFatal and CanRecover[Try].recoverFromNonFatal should use Try's recover (#586)

New Feature

  • rethrowIfLeft and rethrowTIfLeft syntax for F[Either[A, B]] and EitherT[F, A, B] (#588)

    val fa: IO[Either[Throwable, Int]] = pureOf[IO](Right(1))
    fa.rethrowIfLeft
    // IO[Int] = IO(1)
    val fa: IO[Either[Throwable, Int]] = pureOf[IO](Left(new RuntimeException("Error")))
    fa.rethrowIfLeft
    // IO[Int] = RaiseError(RuntimeException("ERROR"))
    val fa: EitherT[IO, Throwable, Int] = pureOf[IO](Right(1)).eitherT
    fa.rethrowTIfLeft
    // IO[Int] = IO(1)
    val fa: EitherT[IO, Throwable, Int] = pureOf[IO](Left(new RuntimeException("Error"))).eitherT
    fa.rethrowTIfLeft
    // IO[Int] = RaiseError(RuntimeException("ERROR"))

v2.0.0-beta12

09 Sep 12:54
2a966fa
Compare
Choose a tag to compare

2.0.0-beta12 - 2023-09-09

New Features

  • Add CanRestart for retrying F[A] (#566)

    trait CanRestart[F[*]] {
      def restartWhile[A](fa: F[A])(p: A => Boolean): F[A]
    
      def restartUntil[A](fa: F[A])(p: A => Boolean): F[A]
    
      def restartOnError[A](fa: F[A])(maxRetries: Long): F[A]
    
      def restartOnErrorIfTrue[A](fa: F[A])(p: Throwable => Boolean): F[A]
    }
  • Add instances of CanCatch, CanHandleError, CanRecover, FromFuture, Fx and FxCtor with Sync and Async (#568)

    So it can be done like this with the effectie.instances.ce2.f and effectie.instances.ce3.f packages.

    def foo[F[*]: Fx](n: Int): F[Int] = Fx[F].effectOf(n * 2)
    
    // Fx[F] can be satisfied with just Sync[F] like this.
    import effectie.instances.ce2.f.fx._
    def bar[F[*]: Sync](n: Int): F[Int] = foo(n)

v2.0.0-beta11

22 Jul 11:43
Compare
Choose a tag to compare

2.0.0-beta11 - 2023-07-22

Fixed

  • Fix the comments of the deprecated methods in Ce2ResourceMaker and Ce3ResourceMaker (#559)
    • Ce2ResourceMaker: Please use withResource instead => Please use Ce2ResourceMaker.maker instead
    • Ce3ResourceMaker: Please use withResource instead => Please use Ce3ResourceMaker.maker instead

v2.0.0-beta10

15 Jul 10:12
a3e18da
Compare
Choose a tag to compare

2.0.0-beta10 - 2023-07-15

New Feature

  • Add fromEffect(fa: => F[A]): F[A] to FxCtor and Fx (#524)

    Fx[IO].fromEffect(IO(1)) // IO[Int]
    FxCtor[IO].fromEffect(IO(1)) // IO[Int]
  • Add make[A](fa: => F[A])(release: A => F[Unit]): ReleasableResource[F, A] to ResourceMaker[F[*]] (#527)

    def make[A](fa: => F[A])(release: A => F[Unit]): ReleasableResource[F, A]
    • Try

      val resourceMaker = ResourceMaker.usingResourceMaker
      resourceMaker
        .make(Try(new SomeResource()))(a => Try(a.release())) // ReleasableResource[Try, SomeResource]
        .use { someResource =>
          // do something with someResource
          Try(result) // Try[ResultType]
        } // Try[ResultType]
    • Future

      val resourceMaker = ResourceMaker.futureResourceMaker
      resourceMaker
        .make(Future(new SomeResource()))(a => Future(a.release())) // ReleasableResource[Future, SomeResource]
        .use { someResource =>
          // do something with someResource
          Future.successful(result) // Future[ResultType]
        } // Future[ResultType]
    • Cats Effect 2

      val resourceMaker = Ce2ResourceMaker.withResource
      resourceMaker
        .make(IO(new SomeResource()))(a => IO(a.release())) // ReleasableResource[IO, SomeResource]
        .use { someResource =>
          // do something with someResource
          IO.pure(result) // IO[ResultType]
        } // IO[ResultType]
    • Cats Effect 3

      val resourceMaker = Ce3ResourceMaker.withResource
      resourceMaker
        .make(IO(new SomeResource()))(a => IO(a.release())) // ReleasableResource[IO, SomeResource]
        .use { someResource =>
          // do something with someResource
          IO.pure(result) // IO[ResultType]
        } // IO[ResultType]
  • Add pure[A](a: A) and eval[A](fa: F[A]) to ResourceMaker (#534)

    trait ResourceMaker[F[*]] {
      ...
    
      def pure[A](a: A): ReleasableResource[F, A]
    
      def eval[A](fa: F[A]): ReleasableResource[F, A]
    }
  • Add ReleasableResource.pure (#542)

    ReleasableResource.pure(resource: A): ReleasableResource[F, A]

    So A doesn't have to be AutoCloseable as it's just a pure value.

  • Add ReleasableResource.map and ReleasableResource.flatMap (#544)

    ReleasableResource.map(f: A => B)
    ReleasableResource.flatMap(f: A => ReleasableResource[F, B])
  • Add Functor type-class for ReleasableResource (#548)

  • Add Applicative type-class for ReleasableResource (#550)

Changes

  • Remove unnecessary re-evaluation of ResourceMaker (#529)

    The following ResourceMaker constructor method is just val now.

    effectie.resource.ResourceMaker.usingResourceMaker
  • Rename withResource in Ce2ResourceMaker and Ce3ResourceMaker to maker (#530)

  • Move ResourceMaker and ReleasableResource to effectie-cats (#546)

    Having ReleasableResource in effectie-cats is required to have Functor and Monad type-classes.

v2.0.0-beta9

18 Mar 07:23
e05560d
Compare
Choose a tag to compare

2.0.0-beta9 - 2023-03-18

New Feature

  • Add Fx instance for Try - Fx[Try] (#512)

Internal Housekeeping

  • Remove cats from the core module (#513)
  • Reorganize tests (#515)

v2.0.0-beta8

07 Mar 12:50
856f445
Compare
Choose a tag to compare

2.0.0-beta8 - 2023-03-07

Changes

  • Remove unused implicit params (#497)

    def catchNonFatal[A](
      f: PartialFunction[Throwable, A]
    )(
      implicit canCatch: CanCatch[F],
      fxCtor: FxCtor[F], // <= This is unused
    ): F[Either[A, B]] =
      canCatch.catchNonFatal[A, B](fb())(f)

    The implicit param fxCtor: FxCtor[F] has been removed.

  • Rename ConsoleEffect to ConsoleFx (#499)

  • Move flatMapFa from CanCatch to FxCtor (#501)

    def flatMapFa[A, B](fa: F[A])(f: A => F[B]): F[B]
  • Move FxCtor from instance creation of ConsoleFx to each ConsoleFx method param (#504)

    implicit def consoleFxF[F[*]: FxCtor: FlatMap]: ConsoleFx[F] = ...

    to

    trait ConsoleFx[F[*]] {
      def readLn(implicit fxCtor: FxCtor[F]): F[String]
    
      def readPassword(implicit fxCtor: FxCtor[F]): F[Array[Char]]
    
      def putStr(value: String)(implicit fxCtor: FxCtor[F]): F[Unit]
    
      def putStrLn(value: String)(implicit fxCtor: FxCtor[F]): F[Unit]
    
      def putErrStr(value: String)(implicit fxCtor: FxCtor[F]): F[Unit]
    
      def putErrStrLn(value: String)(implicit fxCtor: FxCtor[F]): F[Unit]
    
      def readYesNo(prompt: String)(implicit fxCtor: FxCtor[F]): F[YesNo]
    }
  • ConsoleFx instance should not depend on cats (Monad) (#505)

    Instead, it depends on FxCtor now.

v2.0.0-beta7

25 Feb 12:36
3e4dafa
Compare
Choose a tag to compare

2.0.0-beta7 - 2023-02-25

New Features

  • Add pureOfOption, pureOfSome, pureOfNone, pureOfRight and pureOfLeft to FxCtor and Fx (#488)
    • Fx[F].pureOfOption[A](a: A): F[Option[A]]
    • Fx[F].pureOfSome[A](a: A): F[Option[A]]
    • Fx[F].pureOfNone[A]: F[Option[A]]
    • Fx[F].pureOfRight[A][B](b: B): F[Either[A, B]]
    • Fx[F].pureOfLeft[B][A](a: A): F[Either[A, B]]

Fix

  • Fix typo in the missing implicit instance messages (#489)

v2.0.0-beta6

11 Feb 12:51
d87b3c6
Compare
Choose a tag to compare

2.0.0-beta6 - 2023-02-11

Change

  • Remove implicit fxCtor: FxCtor[F] param from the catch methods in CanCatch (#480)

    The following methods in CanCatch

    def catchNonFatal[A, B](
      fb: => F[B]
    )(
      f: PartialFunction[Throwable, A]
    )(
      implicit fxCtor: FxCtor[F]
    ): F[Either[A, B]]
    
    def catchNonFatalEither[A, AA >: A, B](
      fab: => F[Either[A, B]]
    )(
      f: PartialFunction[Throwable, AA]
    )(
      implicit fxCtor: FxCtor[F]
    ): F[Either[AA, B]] 

    have been changed to

    def catchNonFatal[A, B](
      fb: => F[B]
    )(
      f: PartialFunction[Throwable, A]
    ): F[Either[A, B]]
    
    def catchNonFatalEither[A, AA >: A, B](
      fab: => F[Either[A, B]]
    )(
      f: PartialFunction[Throwable, AA]
    ): F[Either[AA, B]] 

v2.0.0-beta5

13 Jan 18:11
144978e
Compare
Choose a tag to compare

2.0.0-beta5 - 2023-01-14

New Features

  • Add ResourceMaker (#468)

    ResourceMaker[F].forAutoCloseable[A <: AutoCloseable](fa: F[A]): ReleasableResource[F, A]
    import effectie.resource.ResourceMaker
    
    ResourceMaker.usingResourceMaker // ResourceMaker[Try]
    ResourceMaker.futureResourceMaker(implicit ec: ExecutionContext) // ResourceMaker[Future]
    import effectie.resource.Ce2ResourceMaker
    
    Ce2ResourceMaker.forAutoCloseable // ResourceMaker[F] where F[*]: Sync: BracketThrow
    import effectie.resource.Ce3Resource
    
    Ce3Resource.forAutoCloseable // ResourceMaker[F] where F[*]: Sync: MonadCancelThrow

Internal Housekeeping

  • cats-effect 3.3.5 => 3.3.14