[Haskell-cafe] Open Source project suitable for 2-3 persons this fall?

Tobias Dammers tdammers at gmail.com
Fri Jul 5 10:10:12 CEST 2013


There's one of my hobby projects that could use some manpower to
bootstrap it into a production-quality tool. It's an HTML templating
system; right now it reads input templates in one of two languages (one
very declarative, very similar to Python's jinja2, the other being a
locally-pure functional language with a curly-bracket syntax), and it
can output PHP and JavaScript as well as execute templates directly in
Haskell code. There's also a rather experimental JSON-based intermediate
format, designed for high-security scenarios (JSON can be parsed
quickly, but because it cannot contain arbitrary code, a compromised
compiler can be mitigated by whitelisting what the runtime can do; this
way, only the runtime has to be audited, not the compiler).

There is an incomplete implementation of a PHP library that can
interpret this intermediate JSON format, but it hasn't been used in any
production-quality project yet.

The core part is the compiler, consisting of a
Parsec-based parser, an AST, an optimizer, and a few backends.

The unique selling points:

* Pre-compile your templates - now you can have the cake (expressive
  clean template language) and eat it too (great performance, because
  it's pre-compiled to your web app's native language).
* Use the same template for PHP, Haskell and JavaScript (and maybe
  others, too).
* Bye bye XSS: HTML-encoding is the default.
* Extensible: Hook up your own native functions - it's as simple as
  adding a function to your template input data, then calling it inside
  the template.

It could use some work in a lot of areas; projects could include, for
example:

- Getting the JavaScript backend to support 100% of the language
  features (right now, only the direct-execution and PHP backends pass
  all tests)
- Implement some glue to allow easy embedding in Haskell web
  applications (yesod / happstack / snap)
- Add more features to the input language (some of which would also
  require some changes to the backends), e.g.:
  - range literals
  - list comprehensions
  - indexed for-each, or some way of getting the current iteration's
	index; very useful for things like zebra-stripe data grids and
	such
- Add other backends (Python and Ruby would be the most obvious
  candidates, but I'm really open to anything)
- Add more library functions
- A better optimizer
- Some tooling and integration support, e.g. some kind of mechanism to
  switch between executing on-the-fly (for development) and using
  pre-compiled templates (for production), something to implement
  graceful degrading on the client side (use client-side templates when
  possible, fall back to postbacks and server-side templates as needed),
  syntax highlighters for popular editors, etc.

Anyway, here's the source:

https://bitbucket.org/tdammers/hpaco

The PHP lib/script that can produce and run a subset of the JSON
intermediate format is here:

https://bitbucket.org/tdammers/phpaco

(Any contributions, feedback, etc., very welcome)

On Thu, Jul 04, 2013 at 05:26:59PM +0200, Anders Bech Mellson wrote:
> Is there any project that needs working this fall which could be used as a
> university project?
> 
> I am in the university (M.Sc. in software development),
> so I am mainly looking for project ideas (preferably concrete ones).
> 
> We are 2-3 students that have ~10 hours pr week for 3 months to work on a
> project.
> 
> Is there a listing somewhere with project ideas for contributing to the
> Haskell community?
> 
> Thanks in advance,
> Anders

> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe




More information about the Haskell-Cafe mailing list