[Haskell-cafe] Haskell syntax/indentation for vim

Tristan Ravitch travitch at cs.wisc.edu
Mon Mar 4 18:40:40 CET 2013


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 at gmail.com <
> dag.odenhall at 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 at gmail.com <
> > dag.odenhall at 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 at 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 at haskell.org
> >>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> >>>
> >>>
> >>
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130304/ecef4668/attachment.pgp>


More information about the Haskell-Cafe mailing list