Hi,

I wrote a Haskell indenter for Haskell for the Kate editor a few years ago, which – if I remember correctly – worked quite well. It's quite simple and doesn't try to bee *too* clever, but has some logic for when it should dedent. Not sure if it's helpful, but you could have a look (it's well-commented javascript):

https://projects.kde.org/projects/kde/kde-baseapps/kate/repository/revisions/master/entry/part/script/data/indentation/haskell.js

Erlend


On 4 March 2013 09:40, Tristan Ravitch <travitch@cs.wisc.edu> wrote:
I like automatic "outdenting" too, but I only came up with three cases
where I felt like I could do it reliably:

 * With let/in as you described
 * After a catchall case:

   case ... of
     C1 -> ...
     C2 -> ...
     _ -> ...
   -- dedent back to here

 * And similarly after a do block ending in a return

Even that last one is slightly questionable, I feel, but probably works
for almost all cases.  Are there any others?

On Mon, Mar 04, 2013 at 12:20:12PM -0500, Dan Doel wrote:
> I hadn't seen this before, but I tried it out, and the parts I'm interested
> in are nice. The indenting is less flaky than what I was using before
> (comments had issues).
>
> If you're rewriting things, though, it'd be nice to be able to customize
> indentation a little more. For instance, I like laying out ifs like:
>
>     if foo
>       then bar
>       else baz
>
> But I like to lay out wheres as:
>
>     foo = ...
>      where
>      bar = ...
>
> But both the indents here are based on shiftwidth, so they're tied together.
>
> Another 'nice to have' would be some intelligent outdenting. For instance,
> if you type a let block right now:
>
>     let foo = zig
>         bar = zag
>         in ...
>
> That's what you'll get. It'd be nice if typing the 'in' snapped back to the
> let. I know it's possible to implement something like this, because the
> scala indentation mode I use frequently outdents when I type '=>' (which
> annoys the hell out of me, because it's almost never correct), but I don't
> know if it can be done intelligently enough to be useful (which would be
> important). Something to keep in mind, though.
>
> -- Dan
>
>
> On Sun, Mar 3, 2013 at 9:48 AM, dag.odenhall@gmail.com <
> dag.odenhall@gmail.com> wrote:
>
> > I see now in your README that you have seen vim2hs.  I'd love to hear what
> > you disliked about it, especially given my plan to rewrite the whole thing
> > [1]! :)
> >
> > [1] https://github.com/dag/vim2hs/issues/45
> >
> >
> > On Sun, Mar 3, 2013 at 3:38 PM, dag.odenhall@gmail.com <
> > dag.odenhall@gmail.com> wrote:
> >
> >> Hi
> >>
> >> Have you seen vim2hs?
> >>
> >> https://github.com/dag/vim2hs
> >>
> >>
> >> On Sat, Mar 2, 2013 at 9:11 PM, Tristan Ravitch <travitch@cs.wisc.edu>wrote:
> >>
> >>> Cafe,
> >>>
> >>> I've recently been playing with vim and wasn't quite satisfied with the
> >>> existing syntax highlighting and indentation, so I thought I'd try my
> >>> hand at a new Haskell mode:
> >>>
> >>> https://github.com/travitch/hasksyn
> >>>
> >>> It is minimal in that it doesn't provide support for running external
> >>> commands over code or anything fancy.  It just does syntax highlighting
> >>> and reasonably-smart indentation.  There is no support for literate
> >>> Haskell since supporting both with one mode is very tricky.
> >>>
> >>> It might be useful to some people.  Comments, bug reports, and
> >>> suggestions
> >>> welcome.
> >>>
> >>> _______________________________________________
> >>> Haskell-Cafe mailing list
> >>> Haskell-Cafe@haskell.org
> >>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> >>>
> >>>
> >>
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >

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




--
Erlend Hamberg
ehamberg@gmail.com