caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocp-indent begin/end behaviour?
Date: Mon, 19 Sep 2016 11:39:12 +0200	[thread overview]
Message-ID: <20160919093912.GA27810@frosties> (raw)
In-Reply-To: <86zin96l8z.fsf@gmail.com>

On Thu, Sep 15, 2016 at 07:01:00PM +0000, Malcolm Matalka wrote:
> I have the following code that I'm using ocp-indent to indent:
> 
> let () =
>   match Random.int 10 with
>     | 1 -> begin
>         zoom ();
>         baz ()
>       end
>     | 2 ->
>       ()
> 
> The zoom and baz are indented "double", and I cannot figure out how to
> undo that.  I'd like the begin/end to have no effect on indentation at
> all.  Is this a bug or am I doing something wrong?
> 
> /Malcolm

Double seems right since the match case indents and begin/end also
needs to indent since it creates a sub block. Consider this:

let () =
  match Random.int 10 with
    | 1 ->
      bar ();
      begin
        zoom ();
        baz ()
      end;
      foo ()
    | 2 ->
      ()

Note: The only reason to use begin/end for a match case is if you have
another match inside I believe.

MfG
	Goswin

  reply	other threads:[~2016-09-19  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-15 19:01 Malcolm Matalka
2016-09-19  9:39 ` Goswin von Brederlow [this message]
2016-10-03  7:02 ` Louis Gesbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160919093912.GA27810@frosties \
    --to=goswin-v-b@web.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).