Git Product home page Git Product logo

Comments (1)

inkblot avatar inkblot commented on August 16, 2024

That was fun and enlightening. I started with the previously discussed transformation from IO to Try and that was straightforward. It pointed toward a generalism about transformations that simply run the monadic effect - I'll come back to that. It's generally possible to write two kinds of transformations generically.

When there are Monad and MonadT implementations of the same effect, e.g. Either and EitherT, it is generally possible to create a NaturalTransformation from the Monad to the MonadT given a Pure for the argument Monad.

Also, I'm not convinced that it's quite as universal, but it's often possible to create a NaturalTransformation that maps the argument Monad of a MonadT, given a NaturalTransformation from the existing argument Monad to a new one. I'm hesitant to say that this "mapping" transformations are generally possible because I am suspicious about MonadTs that are also a MonadReader. As I was writing MappingReaderT I began to wonder what would have to happen with a different MonadReader where R was itself parameterized with aMonad. If such a MonadT required agreement between its own argument Monad and the Monad parameter of the MonadReader's R then it would probably require the ability to reverse-transform the type parameter of the R type in order to transform the MonadT.

The big realization I had while writing these occurred while I tried to find ways to implement "runners". In order to implement a "runner" NaturalTransformation, a Monad needs to yield another Monad with the same carrier when it's run. However, it's pretty common for a Monad to yield another Monad with a different carrier, e.g. EitherT::runEitherT. This type of operation can be generalized as Fn1<Functor<A, F>, Functor<B, G>> and correctly capture all of the type information, but I can't help but wonder if there might be some use in specializing this kind of function.

I'm going to give it a try. Running EitherT seems like a pretty good first target.

from sly.

Related Issues (1)

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.