nilcons / hi2

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

haskell-style-guide #2

Closed superbobry closed 11 years ago

superbobry commented 11 years ago

Is it possible to make hi2 provide indentation similar to the one described in haskell-style-guide?

hvr commented 11 years ago

Fyi, this works the same way as with haskell-indentation which hi2 is derived from, i.e. by customizing the following variables (use M-x customize-group [RET] hi2 for that):

;; Note: this variables should be set buffer local!
(setq hi2-layout-offset 4
      hi2-left-offset 4
      hi2-ifte-offset 4)

However, what doesn't seem possible yet is setting the indentation of the initial guard to 2 spaces (so that it aligns with the where clause) according to the haskell-style-guide variation as used by the Snap framework

superbobry commented 11 years ago

Thanks, but even with the settings above record types are indented incorrectly:

data Foo = Foo
           { fooBar :: Int, ... }  -- try pressing TAB on this line.
errge commented 11 years ago

Thanks for reporting these issues. Instead of just referring me to the haskell-style-guide, if you have issues, please provide concrete examples where the mode works incorrectly, like you provided in the last comment. It's a lot easier to look into concrete issues than to learn other people coding styles just to compare to the current parser. What would be the wanted behavior after Foo? To indent it two spaces more?

And hvr is totally right, currently the parser is not changed in any significant way compared to haskell-indentation-mode. I plan to look into it on http://www.haskell.org/haskellwiki/ZuriHac2013, so maybe I'll fix these two issues then.

Thanks again for testing this!

superbobry commented 11 years ago

What would be the wanted behavior after Foo? To indent it two spaces more?

The wanted behaviour is:

data Foo = Foo
    { fooBar :: Int, ... } 

I'll move the discussion to a more concrete issue, thank you!