Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Michael <michipili@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Writing Awk in OCaml
Date: Mon, 29 Jul 2013 14:40:18 +0200	[thread overview]
Message-ID: <51F662B2.7070102@inria.fr> (raw)
In-Reply-To: <B3FE1B71-74DC-4674-BFE2-7A44186E527D@gmail.com>

On 2013-07-28 10:43, Michael wrote:
> With the above signature, we can write (1)
> 
> bind u f1: row -> state -> stat
> bind (bind v f1) f2 : row -> state -> stat
> 
> But it would be quite nice to be able to write the following expressions so
> that they are defined and correctly type (2):
> 
> bind u f1 : row -> state -> state
> bind v f1 f2 : row -> state -> state
> 
> Is there any way to rewrite things so that the cumbersome (1) can be replaced
> by the slick (2) ?

Just use a left-associative infix symbol for "bind", it will be real slick:

    let (++) = bind

    v ++ f1 ++ f2     (* i.e. bind (bind  v f1) f2  *)

Hope this helps,

- Xavier Leroy

  reply	other threads:[~2013-07-29 12:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-28  8:43 Michael
2013-07-29 12:40 ` Xavier Leroy [this message]
2013-07-30 17:57   ` Michael

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=51F662B2.7070102@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=michipili@gmail.com \
    /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