Tired of having to write a full-blown compiler for your XML-based plane control language ? Tired of writing monadic-style computations no-one understands ?
val willInline = maybeName
.flatMap(name => {
env(name).map(fun => {
(fun, size(fun.body))
})
})
.filter(_._2 <= funLimit)
.map(_._1)
.filter(fun => sameLen(fun.args, args))
Look no further, Exproc will ease your life.
val willInline = maybeFlow {
val name = ! maybeName
val fun = ! env(name)
if (size(fun.body) <= funLimit && sameLen(fun.args, args)) then
Some(fun)
else
None
}
Inspired from F#'s computation expressions, some possible monadic-flows are available in the tests.
Two examples are available, both based upon tiny languages used in videogames:
- less-funky-trees A compiler for simple planes;
- Human Resource Scala Machine A compiler for Human Resource Machine.