Giter VIP home page Giter VIP logo

mainecoon's Introduction

mainecoon's People

Contributors

aoiroaoino avatar hanny24 avatar jentsch avatar kailuowang avatar kubukoz avatar nigredo-tori avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mainecoon's Issues

Collaboration?

Hi there,

Just stumbled onto this project. It looks like you and I independently ended up in pretty much the same space. If you haven't yet, take a look at diesel.

Maybe we can work together?

Lloyd

Suppress wartremover warnings

There is a relatively popular linter for Scala - wartremover. It works as a compiler plugin, which allows it to tap into typing and other low-level compiler details to provide some pretty useful checks ("warts"). The problem is that it has to work after macro expansion phase. As far as I understand, there is no reliable way to detect expanded macros, though.

This means that mainecoon's generated code gets checked as well. In particular, this sample:

@autoFunctorK
trait Foo[F[_]] {
  def pure[A](a: A): F[A]
}

triggers this warning:

<macro>:9: [wartremover:ImplicitParameter] Implicit parameters are disabled
      object autoDerive { implicit def fromFunctorK[F[_], G[_]](implicit fk: _root_.cats.~>[F, G], FK: _root_.mainecoon.FunctorK[({ type λ[Ƒ[_]] = Foo[Ƒ] })#λ], af: Foo[F]): Foo[G] = FK.mapK(af)(fk) }
                                       ^

The root of the issue here seems to be implicit parameter FK, which includes neither F, nor G.

Here are the ways for a user to get rid of this warning:

  1. Disable this wart for the whole project
  2. Exclude all files using autoFunctorK
  3. Add @SuppressWarnings annotation to the companion object

The third approach, though a bit counterintuitive, allows at least some granularity.

It would be far better to only exclude the generated code. This, however, can only be done in mainecoon itself. This would only require adding this annotation to generated definitions:

@SuppressWarnings(Array("org.wartremover.warts.ImplicitParameter"))

Add an ApplyK type class?

I'd love to see a very simple ApplyK typeclass that'd let us use something like this:

def map2K[F[_], G[_], H[_]](af: A[F], ag: A[G])(f: Tuple2K[F, G, ?] ~> H): A[H]

And it should also be able to be derived fairly easily, right?

Embed monad transformers

When we have a MonadTrans type class we can add a embed method to FunctorK:

def embed[M[_], MT[_[_], _]](fa: F[M])(implicit D: MonadTrans[MT], M: Monad[M]): F[MT[M, ?]] = functorK.mapK(fa)(new (M ~> MT[M, ?]) {
      override def apply[A](fa: M[A]): MT[M, A] = D.lift(fa)
    })

Maybe it would be nice if we can define the natural transformation implicitly such that we can embed a M[_] into a complex monad transformer stack. Like Future ~> EitherT[WriterT[Future, List[String], ?], String, ?].

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.