Re: Typing of Pattern Synonyms: Required vs Provided constraints [was cafe DatatypeContexts / alternative]

2022-01-06 Thread Anthony Clayden
[Picking up a cafe thread from February that fits here https://mail.haskell.org/pipermail/haskell-cafe/2021-February/133459.html.] Am 23.02.21 um 20:07 schrieb Richard Eisenberg: >* You might be interested in my recent paper on exactly this problem: *>* how to make DatatypeContexts actually work t

Re: Typing of Pattern Synonyms: Required vs Provided constraints

2022-01-06 Thread Anthony Clayden
On Fri, 7 Jan 2022 at 09:08, Richard Eisenberg wrote: > > > On Jan 5, 2022, at 9:19 PM, Anthony Clayden > wrote: > > So Pattern syns seem to be giving exactly the 'stupid theta' behaviour. > > > In your example, yes: the Required context is "stupid" in the way that > "stupid theta" is. The reaso

Fwd: Typing of Pattern Synonyms: Required vs Provided constraints

2022-01-06 Thread Anthony Clayden
Thanks Gergö, I do find Richard's tendency to use ViewPattern examples distracts me from understanding the point. That arrow-to-nowhere or arrow-to-the-wrong-value syntax is nausea-inducing. Your "instructive" example is really nothing to do with PatSyns, just ordinary Haskell numeric patterns: th

Re: Typing of Pattern Synonyms: Required vs Provided constraints

2022-01-06 Thread Gergő Érdi
Fwiw, a less contrived, and much more relatable, version of Richard's example would be pattern Is3 :: (Num a, Eq a) => a -- only a Required constraint pattern Is3 = 3 -- a polymorphic literal! I think it can be quite instructive for people new to patsyn typing to work out why this is exactly t

Re: Typing of Pattern Synonyms: Required vs Provided constraints

2022-01-06 Thread Richard Eisenberg
> On Jan 5, 2022, at 9:19 PM, Anthony Clayden > wrote: > > So Pattern syns seem to be giving exactly the 'stupid theta' behaviour. In your example, yes: the Required context is "stupid" in the way that "stupid theta" is. The reason to have a Required context is if your pattern synonym does