anoma / juvix

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

Add do-notation #2355

Closed janmasrovira closed 6 days ago

janmasrovira commented 11 months 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 2 months ago

Wait until we have use-cases in Anoma applications.