caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Terser ppx syntax for common usage (like monads)
@ 2015-10-10 13:48 Petter A. Urkedal
  2015-10-10 13:57 ` Petter A. Urkedal
  2015-10-10 14:09 ` Daniel Bünzli
  0 siblings, 2 replies; 4+ messages in thread
From: Petter A. Urkedal @ 2015-10-10 13:48 UTC (permalink / raw)
  To: caml users

Now that we're replacing camlp4 with ppx, we're also replacing e.g.

  lwt x = ....

the longer

  let%lwt x = ...

Now, that's not necessarily a bad thing, but the monad bind operation
tends to be quite invasive, so I'd like to suggest adding a shorter
syntax which the user could choose to map to their most pervasive ppx
rewriter.  I think a good candidate would be

  let* x = ...
  for* x = ... do ... done
  try* ...
  etc.

One way to implement this would be to map kw* to kw%ast, and leave it
to the ppx extensions to accept an option telling it whether to
process "ast" tagged nodes or not. Alternatively, it could be a
compiler option.

My reason for choosing "*" is 1) it looks okay in my opinion, 2) it is
only used as a binary operator, so it can't interfere with existing
code, like e.g. "let!" could.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-10 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-10 13:48 [Caml-list] Terser ppx syntax for common usage (like monads) Petter A. Urkedal
2015-10-10 13:57 ` Petter A. Urkedal
2015-10-10 14:09 ` Daniel Bünzli
2015-10-10 17:32   ` Petter A. Urkedal

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).