# Conventions for let+, let\*, etc

**URL:** https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969
**Category:** Learning
**Created:** [December 14, 2020, 11:37am UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969 "2020-12-14T11:37:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kkirstein](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kkirstein/32/1964_2.png) [@kkirstein](https://discuss.ocaml.org/u/kkirstein)
#### Post date: [December 14, 2020, 11:37am UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969/1 "2020-12-14T11:37:05Z")

</div>

I still need to wrap my head around the new let+, let\*, and+,… syntax “operators”, but nevertheless just started using them. [This post](http://jobjo.github.io/2019/04/24/ocaml-has-some-new-shiny-syntax.html) helped me to get started and the type system (thanks to merlin, ocaml-lsp) is a good guide, anyhow.  
This is my question: Are there any conventions, when to use let+ vs. let\*, e.g., one for monads, the other for applicatives, or so?

---

<div class="post-metadata">

### Author: ![ttamttam](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ttamttam/32/132_2.png) [@ttamttam](https://discuss.ocaml.org/u/ttamttam)
#### Post date: [December 14, 2020, 12:17pm UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969/2 "2020-12-14T12:17:45Z")

</div>

Have a look at [@CraigFe operator lookup tool](https://discuss.ocaml.org/t/ann-operator-lookup-tool-for-ocaml/6882). There is also a nice explanation for those operators.

---

<div class="post-metadata">

### Author: ![kkirstein](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kkirstein/32/1964_2.png) [@kkirstein](https://discuss.ocaml.org/u/kkirstein)
#### Post date: [December 14, 2020, 1:46pm UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969/3 "2020-12-14T13:46:05Z")

</div>

Wow, this is really cool! If not done, we should add a link on [ocaml.org](https://ocaml.org/) and/or [ocamlverse](https://ocamlverse.github.io/).

---

<div class="post-metadata">

### Author: ![gadmm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/gadmm/32/877_2.png) [@gadmm](https://discuss.ocaml.org/u/gadmm)
#### Post date: [December 14, 2020, 6:18pm UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969/4 "2020-12-14T18:18:14Z")

</div>

It is nice that the community discusses conventions around let-operators. Speaking of conventions, a discussion about a let operator to mimic F#'s `use` keyword for binding resources arose at [https://github.com/ocaml/ocaml/pull/9887](https://github.com/ocaml/ocaml/pull/9887). The PR generated an interesting discussion based on actual code but I believe it is up to the community to pick up the suggestion from there.

---

<div class="post-metadata">

### Author: ![kkirstein](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kkirstein/32/1964_2.png) [@kkirstein](https://discuss.ocaml.org/u/kkirstein)
#### Post date: [December 15, 2020, 8:03am UTC](https://discuss.ocaml.org/t/conventions-for-let-let-etc/6969/5 "2020-12-15T08:03:11Z")

</div>

For completeness, I am citing the linked lookup tool:

## let\*

This is a **Monadic** binding operator.

val ( let\* ) : 'a t -\> ('a -\> 'b t) -\> 'b t

… for some type operator `t` . This operator could have any type, but conventionally we use it to implement the [monadic bind](https://www.cs.cornell.edu/courses/cs3110/2019sp/textbook/ads/monads.html) operation for a type, making it the syntax equivalent of the infix operator ( `>>=` ).

## let+

This is a **Map** binding operator.

val ( let+ ) : 'a t -\> ('a -\> 'b) -\> 'b t

… for some type operator `t` . This operator could have any type, but conventionally we use it to implement the [map](https://en.wikipedia.org/wiki/Map_(higher-order_function)) operation for a type, making it the syntax equivalent of the infix operator ( `>>|` ).
