Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-06 Thread ÉRDI Gergő
On Tue, 5 Oct 2021, David Feuer wrote: To be clear, the proposal to allow different constraints was accepted, but integrating it into the current, incredibly complex, code was well beyond the limited abilities of the one person who made an attempt. Totally severing pattern synonyms from

RE: Pattern synonym constraints :: Ord a => () => ...

2021-10-06 Thread Simon Peyton Jones via Glasgow-haskell-users
ytonjo...@gmail.com<mailto:simon.peytonjo...@gmail.com> instead. (For now, it just forwards to simo...@microsoft.com.) From: Anthony Clayden Sent: 06 October 2021 11:42 To: Simon Peyton Jones Cc: Gergő Érdi ; GHC users Subject: Re: Pattern synonym constraints :: Ord a => () => ...

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-06 Thread Anthony Clayden
On Wed, 6 Oct 2021 at 21:24, Simon Peyton Jones wrote: > > > I suggest the User Guide needs an example where a constraint needed for > matching (presumably via a View pattern) is not amongst the > constraints carried inside the data constructor, nor amongst those needed > for building. Then the

RE: Pattern synonym constraints :: Ord a => () => ...

2021-10-06 Thread Simon Peyton Jones via Glasgow-haskell-users
s to simo...@microsoft.com.) From: Glasgow-haskell-users On Behalf Of Anthony Clayden Sent: 06 October 2021 06:25 To: Gergő Érdi Cc: GHC users Subject: Re: Pattern synonym constraints :: Ord a => () => ... Thanks Gergö, I've read that paper many times (and the User Guide). Nowhere does it m

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Anthony Clayden
Thanks Gergö, I've read that paper many times (and the User Guide). Nowhere does it make the distinction between required-for-building vs required-for-matching. And since most of the syntax for PatSyns (the `where` equations) is taken up with building, I'd taken it that "required" means

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Gergő Érdi
> I'm afraid none of this is apparent from the User Guide -- and I even > contributed some material to the Guide, without ever understanding that. > Before this thread, I took it that 'Required' means for building -- as in for > smart constructors. No, that's not what the required/provided

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Gergő Érdi
If you haven't yet, it is probably a good idea to read section 6 of https://gergo.erdi.hu/papers/patsyns/2016-hs-patsyns-ext.pdf On Wed, Oct 6, 2021 at 10:23 AM Gergő Érdi wrote: > > > I'm afraid none of this is apparent from the User Guide -- and I even > > contributed some material to the

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Anthony Clayden
Thank you. Yes that proposal seems in 'the same ball park'. As Richard's already noted, a H98 data constructor can't _Provide_ any constraints, because it has no dictionaries wrapped up inside. But I'm not asking it to! The current PatSyn signatures don't distinguish between Required-for-building

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Anthony Clayden
Thank you Richard (and for the reply to a similar topic on the cafe). What I meant by the comparison to 'stupid theta' is that GHC's implementation of datatype contexts used to be mildly useful and moderately sensible. Then it went stupid, following this 'Contexts on datatype declarations'

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Richard Eisenberg
You're right -- my apologies. Here is the accepted proposal: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0042-bidir-constr-sigs.rst Richard > On Oct 5, 2021, at 12:38 PM, David Feuer wrote: > > To be clear, the proposal to allow different constraints was accepted, but

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread David Feuer
I meant my own brief attempt. Severing them absolutely wouldn't make them less useful. pattern Foo :: ... pattern Foo x <- constructor Foo :: ... constructor Foo x = ... Separate namespaces, so you can have both, and both can be bundled with a type. On Tue, Oct 5, 2021, 1:11 PM Edward

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Edward Kmett
On Tue, Oct 5, 2021 at 12:39 PM David Feuer wrote: > To be clear, the proposal to allow different constraints was accepted, but > integrating it into the current, incredibly complex, code was well beyond > the limited abilities of the one person who made an attempt. Totally > severing pattern

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread David Feuer
To be clear, the proposal to allow different constraints was accepted, but integrating it into the current, incredibly complex, code was well beyond the limited abilities of the one person who made an attempt. Totally severing pattern synonyms from constructor synonyms (giving them separate

Re: Pattern synonym constraints :: Ord a => () => ...

2021-10-05 Thread Richard Eisenberg
> On Oct 3, 2021, at 5:38 AM, Anthony Clayden > wrote: > > >pattern SmartConstr :: Ord a => () => ... > > Seems to mean: > > * Required constraint is Ord a -- fine, for building Yes. > * Provided constraint is Ord a -- why? for matching/consuming No. Your signature specified that