Stackless Scala with Free Monads

Scala Days 2012 was held in London in April. I presented a paper “Stackless Scala with Free Monads” at the conference. You can read it here: http://blog.higher-order.com/assets/trampolines.pdf

About these ads

5 thoughts on “Stackless Scala with Free Monads

  1. Hi Rúnar, very much enjoyed reading this paper. Couple of questions:

    1. Would it be possible, using a State monad, to implement a Cucumber-like BDD framework, such that each GIVEN/WHEN/THEN step returns a State, which in turn is passed as an input to each subsequent step, thereby eliminating the mutation of common state in test steps?

    2. Would this be desirable, for example in the Play 2.0 / TypeSafe stack?

    3. Has anyone done this yet in scala?

    Thanks,
    -Marc

    • Yeah, that would be totally doable. In fact, you can generalize that solution to an IO monad which is just Free[({type f[x] = Either[I => x, (O, x)})] where I is the type of input signals and O is the type of output signals. What you describe is just a generalization of that monad.

      I don’t think anyone has done exactly what you describe, but I’ve sketched out e.g. client/server program (a REPL for a simple language) where O is executable javascript and I is AJAX requests. The client (running in a browser) can then be seen as a machine that turns Os into Is.

      Runar

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s