Giter Site home page Giter Site logo

iterM analog for FreeT about free HOT 3 CLOSED

ekmett avatar ekmett commented on August 23, 2024
iterM analog for FreeT

from free.

Comments (3)

fizruk avatar fizruk commented on August 23, 2024

Apparantly, forall m. Monad m => t m a gives way more flexibility than MFunctor t => t Identity a.
The reason is that ContT is not actually MFunctor (because m r in (a -> m r) -> m r is in both positive and negative positions), so one cannot turn ContT Identity a into a ContT m a, unless m is isomorphic to Identity.

from free.

fizruk avatar fizruk commented on August 23, 2024

After thinking a bit more on this, I've managed to avoid MFunctor and foralled iterM in my code.

This is what I use now:

transform :: (Functor f, Monad m, MonadTrans t, Monad (t m))
    => (f (t m a) -> t m a) -> FreeT f m a -> t m a
transform phi = iterT phi . hoistIterT lift

runT :: (Functor f, MonadFree f m, MonadTrans t, Monad (t m))
    => FreeT f (t m) a -> t m a
runT = iterT wrapT

from free.

fizruk avatar fizruk commented on August 23, 2024

transform is now merged in #42 as iterTM, so I close this issue.

from free.

Related Issues (20)

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.