gren-lang / gren-lang/compiler
prefix binary operations → curry-able functions
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 503
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Using an operator's prefix notation is unintuitive and prone to errors:
Just 3 |> Maybe.map ((-) 3)
--> Just 0
Proposal: remove (symbol) syntax and prefix binary operations in favor of actual functions:
(^) n exp→n |> toPower exp(/) n div→n |> divideBy div(//) n div→n |> Int.divideBy div(*) n mul→n |> multiplyBy mul(-) n sub→n |> subtract sub(+) a b→b |> add a- ...
(||) a b→a |> and b(&&) bool other→bool |> or othermin a b→a |> atMost bmax a b→a |> atLeast b(<) a b→a |> isBelow b(<=) a b→a |> isAtMost b(>=) a b→a |> isAtLeast b(>) a b→a |> isAbove b(++) init tail,.append init tail→init |> .append tail(::) element list→list |> cons element(<|)→ remove?apply?(|>)→ remove?eat/feed/feedWith/with?(>>)→ remove?(<<)→ remove?over/overTo/to/then/thenTo/compose/furthermore/furtherTo?
including parser operators (replaced by |> skip, |> grab, ...).
My secret hope is that just like %, which was removed in favor of modBy & remainderBy,
conventions will develop abandoning, for example
&&,||,min,max, unary-,^, all parser operatorsinit ++ (middle |> operation) ++ tail- in favor of
init |> append (middle |> operation) |> append tailand sometimes[ init, middle |> operation, tail ] |> concat
- in favor of
(I'm not opposed to removing all listed and more)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name files, tests, or entry points. Start by surveying the compiler's parser and operator handling, then clarify which operators and replacement functions are in scope with maintainers. Done would require an agreed migration scope and corresponding compiler behavior, including parser operators.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100