nilcons / hi2

haskell-indentation 2nd try
GNU General Public License v3.0
33 stars 3 forks source link

Haskell backend #5

Closed superbobry closed 11 years ago

superbobry commented 11 years ago

ocp-indent is a tool for indenting OCaml code, which uses an OCaml backend for the actual indentation engine and a thin ELisp wrapper on top of it.

Maybe hi2 should go this way as well? maintaining a complicated parser in ELisp is a very non trivial task, so why not just write the whole thing in Haskell and then plug it into Emacs?

errge commented 11 years ago

Yes, this is a trivial idea, I thought of this too.

http://www.reddit.com/r/haskell/comments/1k0p0r/ann_hi2_a_better_indentation_mode_for_emacs/

chrisdoner's comment on this announcement shows that he is already warking on something like that. So I don't really want to duplicate this major work before we see how his turns out.

hi2 is meant as a project to fix up current issues with haskell-indentation-mode. Giving it a haskell backend seems to be a non-trivial task. We need emacs <-> haskell communication and forking of haskell on all of the platforms. And also, we still have to (re)write the parser and the logic in Haskell. Or is there already some indentation library for indenting non-desugared haskell code in haskell?

So I'm happy to talk about this, but someone has to come up with some actual code that shows how easy/hard it is, I won't go there alone in the foreseeable future, sorry.

If you're willing to work on this, feel free to reopen the issue and discuss more!

hvr commented 11 years ago

One reason why I try to avoid relying on external tools (unless there's huge enough benefit) is that inter-process communication between external processes and Emacs requires more care if support for non-Unix operating systems such as Windows is needed. Having pure Elisp code is a benefit here, as that usually works out of the box everywhere Emacs runs. Moreover, and external tool introduces the new problem of requiring/verifying that compatible interfaces are used.