Half-width indentation for "where" keyword

Thomas Schilling nominolo at googlemail.com
Tue May 18 11:39:19 EDT 2010


On 18 May 2010 15:26, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Tue, May 18, 2010 at 3:13 PM, Ivan Lazar Miljenovic
> <ivan.miljenovic at gmail.com> wrote:
>>
>> Johan Tibell <johan.tibell at gmail.com> writes:
>> > I'd like to change haskell-indentation (i.e. add an option) so it
>> > indents
>> > the "where" keyword with half an indent (e.g. 1 space instead of two).
>>
>> On the other hand, you then have the problem where it might not be as
>> obvious that there's an indentation (nested where clauses, etc.,
>> especially with blank lines).
>>
>> > Example:
>> >
>> > myFun = do
>> >     print "hi"
>> >     print name
>> >   where
>> >     name = "Mini Me"
>>
>> You seem to have a 2-space indent here...
>>
>> > [snip]
>> >
>> > myFun2 = go ...
>> >   where
>> >     go = ...
>>
>> ... and here
>>
>> > which would look like this with the current scheme
>> >
>> > myFun2 = go ...
>> >     where
>> >         go = ...
>>
>> This looks like a 4-space indent to me.
>>
>
> To clarify, given a default indentation size w (e.g. 2 or 4 spaces) I want
> where to be indented as:
>
> myFun = do
> <w>print "hi"
> <w>print name
> <w/2>where
> <w/2><w/2>name = "Mini Me"
>
> So the new "block" started after where (`name` above) is only indented half
> an indent more than the where keyword.

Actually, I'm personally using this, but with the last line:
<w/2><w>name = "Mini Me"

That makes it more clear that the where-bindings are separate.

BTW, there are two indentation modes -indent and -indentation.  Which
one are you using?

-- 
Push the envelope.  Watch it bend.



More information about the Haskellmode-emacs mailing list