caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Cannasse" <warplayer@free.fr>
To: <caml-list@inria.fr>, "Richard Jones" <rich@annexia.org>
Subject: Re: [Caml-list] Strange syntax error
Date: Sun, 23 Jan 2005 22:44:27 +0100	[thread overview]
Message-ID: <001a01c50194$b7845da0$474cfea9@warp> (raw)
In-Reply-To: <20050123211112.GA14067@furbychan.cocan.org>

> The following compiles fine:
>
>   type t = { keyword : string; cost : float option; }
>
>   let f =
>     function
>       | { keyword = keyword } when keyword.[0] = '-' -> keyword
>       | { keyword = keyword; cost = None } -> keyword
>       | _ -> failwith "whatever"
>
> But this, which surely is equivalent, fails with a syntax error at the
> second '|' character:
>
>   type t = { keyword : string; cost : float option; }
>
>   let f =
>     function
>       | { keyword = keyword } when keyword.[0] = '-' (* -> keyword *)
>       | { keyword = keyword; cost = None } -> keyword
>       | _ -> failwith "whatever"
>
> OCaml 3.08.1.
>
> Is this a parsing bug?
>
> Rich.

I guess you can't have a "when" clause between two patterns, that sounds
logical since it applies to all patterns in the same "group".

Nicolas Cannasse


  reply	other threads:[~2005-01-23 21:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-23 21:11 Richard Jones
2005-01-23 21:44 ` Nicolas Cannasse [this message]
2005-01-23 21:49 ` [Caml-list] " Jon Harrop
2005-01-23 22:23 ` Kurt Welgehausen
2005-01-23 23:12   ` Richard Jones

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='001a01c50194$b7845da0$474cfea9@warp' \
    --to=warplayer@free.fr \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /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).