Giter VIP home page Giter VIP logo

effectie's Introduction

Hi there ๐Ÿ‘‹ I'm Kevin Lee.

Hits

I am a coder, who likes Functional Programming, and mainly use Scala.

I like to develop tools to help ease the pain in my daily tasks and solve real world problems.

๐Ÿ”ญ My Personal Projects

Project Description Repo
whatsub A tool for subtitles (Convert charsets / SMI <=> SRT / Sync) Project Repository
extras Extra tools to make development easier Project Repository
refined4s Newtypes and refinement types for Scala 3 Project Repository
effectie Abstraction for functional effect libraries Project Repository
logger-f Logger for F[_] - Abstraction for logging Project Repository
just-semver Just a Semantic Versioning library for Scala Project Repository
sbt-github-pages Publish GitHub Pages with minimal effort Project Repository
sbt-docusaur sbt plugin for Docusaurus Project Repository
sbt-devoops Upload artifacts and changelog to GitHub Release Project Repository
2020 Hindsight Scala The Good, the Bad and the Ugly Practices in FP Scala
First Day Documents to set up Scala dev environment
maven2sbt A tool to convert Maven pom.xml into sbt build.sbt Project Repository
just-fp A small Functional Programming library Project Repository
j8plus Missing Functional Parts of Java 8 Project Repository
Blog

and more...

These are all my personal projects. I do use Scala at work as well but none is publicly available.

Kevin's GitHub Stats Top Langs
GitHub Streak
Trophy

Readme Card Readme Card

effectie's People

Contributors

dependabot[bot] avatar kevin-lee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

rheehot

effectie's Issues

Add CanRecover

Task

Summary

Add CanRecover[F[_]]

Project Details

Version: 1.2.0

Description

trait CanRecover[F[_]] {
  type Xor[A, B]
  type XorT[A, B]

  def recoverFromNonFatalWith[A, AA >: A](fa: => F[A])(handleError: PartialFunction[Throwable, F[AA]]): F[AA]

  def recoverEitherTFromNonFatalWith[A, AA >: A, B, BB >: B](
    efab: => XorT[A, B]
  )(
    handleError: PartialFunction[Throwable, F[Xor[AA, BB]]]
  ): XorT[AA, BB]

  def recoverFromNonFatal[A, AA >: A](fa: => F[A])(handleError: PartialFunction[Throwable, AA]): F[AA]

  def recoverEitherTFromNonFatal[A, AA >: A, B, BB >: B](
    efab: => XorT[A, B]
  )(
    handleError: PartialFunction[Throwable, Xor[AA, BB]]
  ): XorT[AA, BB]

}

Add CanHandleError

Task

Summary

Add CanHandleError[F[_]]

Project Details

Version: 1.2.0

Description

Add CanHandleError[F[_]] to handle NonFatal errors with error handle from Throwable to F[AA] where AA >: A.

trait CanHandleError[F[_]] {

  type Xor[A, B]
  type XorT[A, B]

  def handleNonFatalWith[A, AA >: A](fa: => F[A])(handleError: Throwable => F[AA]): F[AA]

  def handleEitherTNonFatalWith[A, AA >: A, B, BB >: B](
      efab: => XorT[A, B]
    )(
      handleError: Throwable => F[Xor[AA, BB]]
    ): XorT[AA, BB]

  def handleNonFatal[A, AA >: A](fa: => F[A])(handleError: Throwable => AA): F[AA]

  def handleEitherTNonFatal[A, AA >: A, B, BB >: B](
      efab: => XorT[A, B]
    )(
      handleError: Throwable => Xor[AA, BB]
    ): XorT[AA, BB]

}

Replace effectOfPure with pureOf

Task

Summary

Replace effectOfPure with pureOf.

Project Details

Version: 1.3.0

Description

Add pureOf as a replacement of effectOfPure and deprecate effectOfPure.

EffectConstructor[F].pureOf(a) // F[A]
// which is equivalent to EffectConstructor[F].effectOfPure(a)

Change Attempt to CanCatch

Task

Summary

Change Attempt to CanCatch

Project Details

Version: 0.4.0

Description

Change Attempt to CanCatch and change Attempt.attempt to CanCatch.catchNonFatal to make it more descriptive.

Add EffectConstructor for Future and Id

Task

Summary

Add EffectConstructor for Future and Id

Project Details

Version: 0.3.0

Description

Add EffectConstructor typeclass instances for Future and Id.

Improve type inference in Effectful, OptionTSupport and EitherTSupport

Task

Summary

Improve type inference in Effectful, OptionTSupport and EitherTSupport.

Project Details

Version: 1.0.0

Description

Improve type inference in Effectful, OptionTSupport and EitherTSupport with curried and partially applied generic type parameters.

  • Effectful
  • OptionTSupport
  • EitherTSupport

e.g.) From

def effectOf[F[_]: EffectConstructor, A](a: => A): F[A] = EffectConstructor[F].effectOf(a)
                                               ^ A info is available here so why [F, A]?

To

def effectOf[F[_]]: CurriedEffectOf[F] = new CurriedEffectOf[F]

private[Effectful] final class CurriedEffectOf[F[_]] {
  def apply[A](a: => A)(implicit EF: EffectConstructor[F]): F[A] =
    EffectConstructor[F].effectOf(a)
}

So if explicit type argument should be given it can be done like

effectOf[F](someValue)

instead of

effectOf[F, SomeValue](someValue)

Improve OptionTSupport

Task

Summary

Improve OptionTSupport

Project Details

Version: 0.4.0

Description

Improve OptionTSupport with partially applied type parameters. Also add a OptionT constructor for OptionT[F, A] = OptionT(effectOfPure(none[A)]).

CanCatch.catchNonFatal may not work due to non-lazy evaluation of F[A]

Bug

Summary

CanCatch.catchNonFatal may not work due to non-lazy evaluation of F[A].

Project Details

Version: 1.0.0

Description

CanCatch.catchNonFatal may not work due to non-lazy evaluation of F[A].

e.g.)

def run[F[_]: EffectConstructor: Functor, A](a: => A): F[A] =
  effectOf[F, A](a)

val expectedExpcetion = new RuntimeException("Something's wrong")
lazy val fa = run[Id, Int](throwThrowable[Int](expectedExpcetion))

CanCatch[Id].catchNonFatal(fa)(SomeError.someThrowable) // The exception is thrown here before catching inside `catchNonFatal`.

Cause

CanCatch.catchNonFatal's param is not a call by name param.

Solution

Change

def catchNonFatal[A, B](fb: F[B])(f: Throwable => A): F[Xor[A, B]]

to

def catchNonFatal[A, B](fb: => F[B])(f: Throwable => A): F[Xor[A, B]]

Change unit in EffectConstructor to effectOfUnit

Task

Summary

Change unit in EffectConstructor to effectOfUnit

Project Details

Version: 0.3.0

Description

To make the name consistent with others,

  • change EffectConstructor.unit to EffectConstructor.effectOfUnit
  • and Effectful.effectUnit to Effectful.effecOfUnit

Add FromFuture

Task

Summary

Add FromFuture

Project Details

Version: 1.3.0

Description

FromFuture[F].toEffect[A](future: Future[A]) // F[A]

Add ToFuture

Task

Summary

Add ToFuture

Project Details

Version: 1.3.0

Description

ToFuture[F].unsafeToFuture[A](fa: F[A]) // Future[A]

Replace effectOfUnit with unitOf

Task

Summary

Replace effectOfUnit with unitOf.

Project Details

Version: 1.3.0

Description

Add unitOf as a replacement of effectOfUnit and deprecate effectOfUnit.

EffectConstructor[F].unitOf(a) // F[A]
// which is equivalent to EffectConstructor[F].effectOfUnit(a)

Change the names of effect constructor methods in OptionTSupport to effectOf

Task

Summary

Change the names of effect constructor methods in OptionTSupport to effectOf

Project Details

Version: 0.2.0

Description

For Cats Effect

  • optionTEffect => optionTEffectOf
  • optionTLiftEffect => optionTLiftEffectOf

For Scalaz Effect

  • optionTEffect => optionTEffectOf
  • optionTLiftEffect => optionTLiftEffectOf

Change pureEffect to effectOfPure

Task

Summary

Change pureEffect in effectOfPure.

Project Details

Version: 0.1.0

Description

Change pureEffect to effectOfPure as pureEffect may sound like creating a pure effect, yet it's actually creating an effect of pure value.

  • EffectConstructor.pureEffect => EffectConstructor.effectOfPure
  • Effectful.pureEffect => Effectful.effectOfPure
  • effectie.scalaz.OptionTSupport.optionTPureEffect => effectie.scalaz.OptionTSupport.optionTEffectOfPure
  • effectie.scalaz.OptionTSupport.optionTLiftPureEffect => effectie.scalaz.OptionTSupport.optionTLiftEffectOfPure
  • effectie.scalaz.EitherTSupport.eitherTPureEffect => effectie.scalaz.EitherTSupport.eitherTEffectOfPure
  • effectie.scalaz.EitherTSupport.eitherTLiftPureEffect => effectie.scalaz.EitherTSupport.eitherTLiftEffectOfPure
  • effectie.cats.OptionTSupport.optionTPureEffect => effectie.cats.OptionTSupport.optionTEffectOfPure
  • effectie.cats.OptionTSupport.optionTLiftPureEffect => effectie.cats.OptionTSupport.optionTLiftEffectOfPure
  • effectie.cats.EitherTSupport.eitherTPureEffect => effectie.cats.EitherTSupport.eitherTEffectOfPure
  • effectie.cats.EitherTSupport.eitherTLiftPureEffect => effectie.cats.EitherTSupport.eitherTLiftEffectOfPure

Move ExecutorServiceOps from test to main

Task

Summary

Move ExecutorServiceOps from test to main.

Project Details

Version: 1.1.0

Description

Move ExecutorServiceOps from test to main to make it more useful.

Improve type inference of eitherTRight, eitherTRightPure, eitherTLeft and eitherTLeftPure in EitherTSupport

Task

Summary

Improve type inference of eitherTRight, eitherTRightPure, eitherTLeft and eitherTLeftPure in EitherTSupport

Project Details

Version: 1.1.0

Description

import effectie.cats.EitherTSupport._

eitherTRight[F, A](b: B) // EitherT[F, A, B]
// can be improved to
eitherTRight[A](b: B) // EitherT[F, A, B]

eitherTRightF[F, A](fb: F[B]) // EitherT[F, A, B]
// can be improved to
eitherTRight[A](fb: F[B]) // EitherT[F, A, B]

eitherTRight[F, B](a: A) // EitherT[F, A, B]
// can be improved to
eitherTRight[B](a: A) // EitherT[F, A, B]

eitherTRight[F, B](fa: F[A]) // EitherT[F, A, B]
// can be improved to
eitherTRight[B](fa: F[A]) // EitherT[F, A, B]
import effectie.scalaz.EitherTSupport._

eitherTRight[F, A](b: B) // EitherT[F, A, B]
// can be improved to
eitherTRight[A](b: B) // EitherT[F, A, B]

eitherTRightF[F, A](fb: F[B]) // EitherT[F, A, B]
// can be improved to
eitherTRight[A](fb: F[B]) // EitherT[F, A, B]

eitherTRight[F, B](a: A) // EitherT[F, A, B]
// can be improved to
eitherTRight[B](a: A) // EitherT[F, A, B]

eitherTRight[F, B](fa: F[A]) // EitherT[F, A, B]
// can be improved to
eitherTRight[B](fa: F[A]) // EitherT[F, A, B]

Add Attempt

Task

Summary

Add Attempt

Project Details

Version: 0.4.0

Description

Add Attempt to support SomeEffect[F].attempt.

trait Attempt[F[_]] {
  // this function f handles only NonFatal Throwable
  def attempt[A, B](fb: F[B])(f: Throwable => A): F[Either[A, B]]
}

e.g.)

val f: F[Int] = effectOf(foo(1)) // foo() may throw some Throwable.
Attempt[F].attempt(f)(throwable => s"Error: ${throwable.getMessage}")
// F[Either[String, Int]]

Improve EitherTSupport

Task

Summary

Improve EitherTSupport

Project Details

Version: 0.4.0

Description

Improve EitherTSupport with partially applied type parameters.
e.g.)
Instead of

eitherTLiftF[F, String, Int](effectOfPure(1))

do something like

// F and B can be inferred from the argument, effectOfPure(1)
eitherTRightF[String](effectOfPure(1)) 

Make changes like this to the other EitherT support methods.

Rename Eft Fx

Task

Summary

Rename Eft Fx

Project Details

Version: 1.11.0

Add EitherT extension methods

Task

Summary

Add EitherT extension methods

Project Details

Version: 1.11.0

Description

val fab: F[Either[A, B]] = ???
fab.eitherT // EitherT[F, A, B]

val ab: Either[A, B] = ???
ab.eitherT[F] // Either[F, A, B]

val fb: F[B] = ???
fb.rightT[A] // EitherT[F, A, B]

val b = ???
b.rightTF[F, A] // EitherT[F, A, B]

val fa: F[A] = ???
fa.leftT[B] // EitherT[F, A, B]

val a: A = ???
a.leftTF[F, B] // EitherT[F, A, B]

Change the names of effect constructor methods in EitherTSupport to effectOf

Task

Summary

Change the names of effect constructor methods in EitherTSupport to effectOf

Project Details

Version: 0.2.0

Description

For Cats Effect

  • eitherTEffect => eitherTEffectOf
  • eitherTLiftEffect => eitherTLiftEffectOf

For Scalaz Effect

  • eitherTEffect => eitherTEffectOf
  • eitherTLiftEffect => eitherTLiftEffectOf

Add Catching

Task

Summary

Add Catching

Project Details

Version: 0.4.0

Description

Add Catching to provide convenient ways to use CanCatch.

e.g.)

import effectie.Effectful._
import effectie.cats.Catching._

catchNonFatal(effectOf(something))(throwable => SomeError) // F[Either[SomeError, Something]]

catchNonFatalF(something)(throwable => SomeError) // F[Either[SomeError, Something]]
// The same as catchNonFatal(effectOf(something))(throwable => SomeError)
import effectie.Effectful._
import effectie.scalaz.Catching._

catchNonFatal(effectOf(something))(throwable => SomeError) // F[SomeError \/ Something]

catchNonFatalF(something)(throwable => SomeError) // F[SomeError \/ Something]
// The same as catchNonFatal(effectOf(something))(throwable => SomeError)

Add OptionT extension methods

Task

Summary

Add OptionT extension methods.

Project Details

Version: 1.11.0

Description

val foa: F[Option[A]] = ???
foa.optionT // OptionT[F, A]

val oa: Option[A] = ???
oa.optionT[F] // Option[F, A]

val fa: F[A] = ???
fa.someT OptionT[F, A] // OptionT[F, A]

val a = ???
a.someTF[F] // OptionT[F, A]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.