anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

Add do-notation #2355

Closed janmasrovira closed 3 months ago

janmasrovira commented 1 year ago

We would support three kinds of statements (bind, let, expression), and we could borrow the syntax from haskell.

do {
  <var> <- <expr>; -- bind
  let <fundef>; -- pure let
  <expr>; -- monadic expression
};

In the future we can consider some extensions:

  1. Allow patterns of single constructor types on the left of <-.
  2. @paulcadman mentioned Idris !-notation.
  3. Do notation for Applicative.
paulcadman commented 5 months ago

Wait until we have use-cases in Anoma applications.