Re: Pattern synonym 'Required' constraints === Datatype Contexts(?)

2021-03-11 Thread Lennart Augustsson
The required context on pattern synonyms isn't just useful, it's necessary. Since arbitrary computation can happen in both the pattern matching and construction we need the context. Take Richard's example, without the context on Positive we would infer the wrong type for any use of the Positive

Re: Pattern synonym 'Required' constraints === Datatype Contexts(?)

2021-03-11 Thread Richard Eisenberg
You're right that these features sit in a similar space. The difference is that, with a pattern synonym, the required context might be useful. This is because pattern synonyms can perform computation (via view patterns), and this computation might plausibly require some class constraint. An