Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

effectie v2.0.0-beta10 #553

Merged
merged 1 commit into from
Jul 15, 2023
Merged

effectie v2.0.0-beta10 #553

merged 1 commit into from
Jul 15, 2023

Conversation

kevin-lee
Copy link
Owner

effectie v2.0.0-beta10

2.0.0-beta10 - 2023-07-15

New Feature

  • Add fromEffect(fa: => F[A]): F[A] to FxCtor and Fx (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[*]] (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 (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 (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 (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 (Add Functor type-class for ReleasableResource #548)

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

Changes

@kevin-lee kevin-lee added this to the v2-m1 milestone Jul 15, 2023
@kevin-lee kevin-lee self-assigned this Jul 15, 2023
@github-actions github-actions bot added pr PR release Release v2 Effectie v2 labels Jul 15, 2023
@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Merging #553 (6b0371f) into main (66b76f7) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #553   +/-   ##
=======================================
  Coverage   92.23%   92.23%           
=======================================
  Files          62       62           
  Lines         399      399           
  Branches       10       10           
=======================================
  Hits          368      368           
  Misses         31       31           

@kevin-lee kevin-lee merged commit a3e18da into main Jul 15, 2023
@kevin-lee kevin-lee deleted the prepare-to-release branch July 15, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr PR release Release v2 Effectie v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant