Reduce usage of `$` in Indigo
Clarification and motivation
Indigo code often contains the $
Haskell operator, however since the language is meant to be used by people not familiar with Haskell it would be great to not make it a necessity.
It appears that it is mostly used in 3 places:
- right before
do
is used for a block code - right after
newVar
- right after
setVar a
Common example:
indigoFunction :: Var Integer -> IndigoFunction s Bool
indigoFunction val = defFunction $ do
sum <- newVar $ val +. (0 :: Integer)
setVar sum $ val +. (1 :: Integer))
- seems to be solvable by using the
BlockArguments
extension - is the hardest, but can probably be implemented with Template Haskell, to behave more like an actual keyword does in an imperative language (e.g.
a <- $new expr
or if possible even something like$new a = expr
) - can be solved with a low-priority operator version of
setVar
, e.g.a := expr
Also, cases 2 and 3 can be resolved with putting the expression in parenthesis, but it would be better to avoid that.
Acceptance criteria
The necessity for using $
in Indigo code for the 3 cases described above is removed.