Tristan Ravitch | 2 Mar 21:11 2013
Picon

Haskell syntax/indentation for vim

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
dag.odenhall@gmail.com | 3 Mar 15:38 2013
Picon

Re: Haskell syntax/indentation for vim

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
dag.odenhall@gmail.com | 3 Mar 15:48 2013
Picon

Re: Haskell syntax/indentation for vim

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
Dan Doel | 4 Mar 18:20 2013
Picon

Re: Haskell syntax/indentation for vim

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


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Tristan Ravitch | 4 Mar 18:40 2013
Picon

Re: Haskell syntax/indentation for vim

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
> >
> >
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Dan Doel | 5 Mar 01:55 2013
Picon

Re: Haskell syntax/indentation for vim

They're hard to come by, but some other examples might be...

1) If you type something that is recognizably a guard, it could pop
back other guards:

    foo x y z
      | guard1 = do ...
                    | guard2 = -- outdent now

Not sure how feasible that one is.

2) When you type 'else', outdent to the same indentation as the
associated 'then'.

There may be others, but those are what I could think of after a few
minutes of pondering.

On Mon, Mar 4, 2013 at 12:40 PM, Tristan Ravitch <travitch <at> 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 <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
>> >
>> >
Erlend Hamberg | 5 Mar 06:08 2013
Picon

Re: Haskell syntax/indentation for vim

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 <at> 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 <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
> >
> >

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




--
Erlend Hamberg
ehamberg <at> gmail.com
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Alfredo Di Napoli | 5 Mar 10:30 2013
Picon

Re: Haskell syntax/indentation for vim

Here is the crazy idea; instead of having a vim plugin to "rule-them-all", why you don't join your efforts and create a plugin which does only indentation for Haskell code?


This way, we could have a modular stack and be free to use whatever plugins work for syntax highlighting / unicode syntactic sugar / whatever, but still have a "de facto" plugin for indenting haskell code in Vim in a smart way :)

A.-
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Gmane