Ticket #1609 (new proposed-project)
GHCi in the web browser
|Reported by:||apfelmus||Owned by:||apfelmus|
|Priority:||not yet rated||Keywords:||GHCi, interpreter, web|
GHCi in the web browser
Imagine that you're drawing a picture in Haskell with the diagrams package. Wouldn't it be awesome if you could just enter the expression into GHCi and it would draw the picture right there, like this?
And what about entering a function of type Double -> Double in the interpreter and immediately seeing a graph of it?
The goal of this proposal is to create a Haskell interpreter that is capable of displaying images, animations and even interactive programs.
For maximum adoption and reuse, the GUI of the new interactive interpreter is to be implemented as a HTML page in the web browser. The GUI communicates with a server that is responsible for evaluating Haskell expressions.
Implementing this is not entirely straightforward, but most of the difficult problems have probably already been solved by prior work, like Chris Done's TryHaskell online interpreter and Péter Diviánszky's activehs online courses.
Building on these simple yet powerful basics, the view opens up to a wide range of possible applications:
- A replacement for the local GHCi, by running the server locally. Since the server can load from arbitrary URIs, this already allows us to code collaboratively with [Etherpad].
- Integration with source code editors and IDEs like TextMate. In particular, augment compilation error with hyperlinks that point back to the source file.
- Turn GHCi into an online service, using the SafeHaskell? extension.
- Implementation of a notebook model (like Mathematica) that goes beyond the linear command line model of the traditional GHCi.
- Integrate into documentation tools like Haddock or Brent Yorgey's diagrams user guide, so that explanations and API documentation can now be enhanced with live examples.
- Building a multiple user environment for use in teaching. A single interpreter session can be shared across different clients, be made read-only, and so on.
Of course, this list is just a taste of the possibilities and not everything can be implemented in one summer. Still, I'm sure that the end result will be fantastic and that the emphasis on modularity will enable the Haskell community to build more awesome things on top.