SoC project: Python-Haskell bridge - request for feedback

Michał Janeczek janeczek at gmail.com
Mon Mar 24 21:37:03 CET 2008


Hi,

I am a student interested in participating in this year's SoC.
At http://tsk.ch.uj.edu.pl/~janeczek/socapp.html (and also below
in this email) you can find a draft of my project proposal.

I'd like to ask you to comment on it, especially the deliverables
part. Are you interested in such a project, and if yes, what features
would be most important to you? Is anything missing, or should
something get more priority or attention?

Regards,
Michal


Python-Haskell bridge
=====================

Description
-----------

This project will seek to provide a comprehensive, high level (and thus
easy to use) binding between Haskell and Python programming languages.
This will allow using libraries of either side from each language.


Benefits for Python
-------------------

* Robust, high assurance components

    It might be beneficial to implement safety-critical components
    in a strongly, statically typed language, using Python to keep
    them together. Cryptography or authentication modules can be
    an example.

* Performance improvements for speed-critical code

    Haskell compiled to native code is typically an order of magnitude
    faster than Python. Aside from that, advanced language features
    (such as multicore parallel runtime, very lightweight threads
    and software transactional memory) further serve in improving the
    performance. Haskell could become a safe, high level alternative
    to commonly used C extensions.

* Access to sophisticated libraries

    While its set of libraries is not as comprehensive as that of
    Python, Haskell can still offer some well tested, efficient
    libraries. Examples might be rich parser combinator libraries
    (like Parsec) and persistent, functional data structures.
    QuickCheck testing library could also be used to drive analysis
    of Python code.


Benefits for Haskell
--------------------

The project would benefit Haskell by providing it with access to
an impressive suite of libraries. It also has a potential to help
Haskell adoption, by mitigating risk of using Haskell in a project.


Deliverables
------------

* A low level library to access Python objects from Haskell

* A set of low level functions to convert built-in data types
  between Haskell and Python (strings, numbers, lists,
  dictionaries, functions, generators etc.)

* A higher level library allowing easy (transparent) access to
  Python functions from Haskell, and wrapping Haskell functions
  for Python to access

* A way to easily derive conversion functions for user-defined
  data types/objects. Functions derived in such a way should
  work well with both low level and high level access libraries

* Documentation and a set of examples for all of above


Optional goals
--------------

These are of lower priority, and might require a fair amount of work.
I would like to implement most of them, if technically feasible. If
they don't fit into Summer of Code timeframe, I am planning to finish
afterwards.

* A Python module for accessing functions from Haskell modules without
  manual wrapping (such wrapping should be already easy thanks to the
  high level library). It'd be accomplished through GHC api - if it
  allows it. The Haskell side of the high level library will already
  support such mode of operation

* Extend and refactor the code, to make it support other similar
  dynamic languages. This is a lot of work, and definitely out of
  the scope of Summer of Code project, but some design decisions
  may be influenced by this.


Related projects
----------------

They (and quite possibly some others) will be referenced for ideas.

* MissingPy

    Provides a one way, low level binding to Python. Some of the code
    can be possibly reused, especially data conversion functions. It
    doesn't seem to export all features, in particular function
    callbacks are not supported

* HaXR

    XML-RPC binding for Haskell. It could provide inspiration for
    reconciling Haskell and Python type systems, resulting in a
    friendly interface

* rocaml

    A binding between Ruby and OCaml



More information about the Python-list mailing list