This website requires JavaScript.
Explore
Help
Sign In
anoma
/
juvix
Watch
1
Star
1
Fork
0
You've already forked juvix
mirror of
https://github.com/anoma/juvix.git
synced
2024-12-01 00:04:58 +03:00
Code
Issues
Projects
Releases
Wiki
Activity
fe90da58ed
juvix
/
tests
/
negative
/
UnusedOperatorDef.juvix
5 lines
88 B
Plaintext
Raw
Normal View
History
Unescape
Escape
[scoper] add error for unused operator syntax definitions
2022-02-18 00:00:58 +03:00
module UnusedOperatorDef;
New fixity/iterator syntax (#2332) - Closes #2330 - Closes #2329 This pr implements the syntax changes described in #2330. It drops support for the old yaml-based syntax. Some valid examples: ``` syntax iterator for {init := 1; range := 1}; syntax fixity cons := binary {assoc := right}; syntax fixity cmp := binary; syntax fixity cmp := binary {}; -- debatable whether we want to accept empty {} or not. I think we should ``` # Future work This pr creates an asymmetry between iterators and operators definitions. Iterators definition do not require a constructor. We could add it to make it homogeneous, but it looks a bit redundant: ``` syntax iterator for := mkIterator {init := 1; range := 1}; ``` We could consider merging iterator and fixity declarations with this alternative syntax. ``` syntax XXX for := iterator {init := 1; range := 1}; syntax XXX cons := binary {assoc := right}; ``` where `XXX` is a common keyword. Suggestion by @lukaszcz XXX = declare --------- Co-authored-by: Łukasz Czajka <62751+lukaszcz@users.noreply.github.com> Co-authored-by: Lukasz Czajka <lukasz@heliax.dev>
2023-09-14 11:57:38 +03:00
syntax fixity add := binary;
User-friendly operator declaration syntax (#2270) * Closes #1964 Adds the possibility to define operator fixities. They live in a separate namespace. Standard library defines a few in `Stdlib.Data.Fixity`: ``` syntax fixity rapp {arity: binary, assoc: right}; syntax fixity lapp {arity: binary, assoc: left, same: rapp}; syntax fixity seq {arity: binary, assoc: left, above: [lapp]}; syntax fixity functor {arity: binary, assoc: right}; syntax fixity logical {arity: binary, assoc: right, above: [seq]}; syntax fixity comparison {arity: binary, assoc: none, above: [logical]}; syntax fixity pair {arity: binary, assoc: right}; syntax fixity cons {arity: binary, assoc: right, above: [pair]}; syntax fixity step {arity: binary, assoc: right}; syntax fixity range {arity: binary, assoc: right, above: [step]}; syntax fixity additive {arity: binary, assoc: left, above: [comparison, range, cons]}; syntax fixity multiplicative {arity: binary, assoc: left, above: [additive]}; syntax fixity composition {arity: binary, assoc: right, above: [multiplicative]}; ``` The fixities are identifiers in a separate namespace (different from symbol and module namespaces). They can be exported/imported and then used in operator declarations: ``` import Stdlib.Data.Fixity open; syntax operator && logical; syntax operator || logical; syntax operator + additive; syntax operator * multiplicative; ```
2023-08-09 19:15:51 +03:00
syntax operator + add;
[ pre-commit ] Add support and hooks
2022-04-04 18:44:08 +03:00
end ;
Reference in New Issue
Copy Permalink