Re: ambiguous record field (but not *that* kind of ambiguous record field)

2022-05-16 Thread Joachim Breitner
Hi,

Am Montag, dem 16.05.2022 um 19:09 + schrieb Richard Eisenberg:
> Hi all,
> 
> On a project I'm working on, I wish to declare something like
> 
> data Rec = MkRec { field :: forall a. SomeConstraint a => ... }
> 
> where the ... contains no mention of `a`.
> 
> Even with https://github.com/ghc-proposals/ghc-proposals/pull/448, I
> think there is no way to avoid the ambiguity when setting `field`. Is
> that correct? If so, what shall we do about it? The natural answer is
> somehow to write ... MkRec { field @a = ... } ... but that would
> break significant new syntactic ground. (Maybe it's good new
> syntactic ground, but it would still be very new.)

I’m probably revealing ignorance of #448 this way, but why would

   MkRec { field = \@a -> ...}
   
not work with -XTypeAbstractions

Cheers,
Joachim

-- 
Joachim Breitner
  m...@joachim-breitner.de
  http://www.joachim-breitner.de/

___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: ambiguous record field (but not *that* kind of ambiguous record field)

2022-05-16 Thread Richard Eisenberg


> On May 16, 2022, at 3:45 PM, Sebastian Graf  wrote:
> 
> MkRec { field = \@a -> ... }

Hm -- perhaps you're right. I may have gotten myself all worked up over 
nothing. I was worried that unification would get confused, not sure that the 
`a`s match up. But I now think I was wrong -- it should be OK.

Thanks,
Richard___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


Re: ambiguous record field (but not *that* kind of ambiguous record field)

2022-05-16 Thread Sebastian Graf

Hi Richard,

I'm not sure if I'm missing something, but my adolescent naivety in 
frontend matters would try to reach for
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0155-type-lambda.rst#motivation 
and write


  MkRec { field = \@a -> ... }

and I hope that will do the right thing. Indeed, I interpret your 
proposed `field @a = ...` as much the same.


Sebastian


-- Originalnachricht --
Von: "Richard Eisenberg" 
An: "Erdi, Gergo via ghc-devs" 
Gesendet: 16.05.2022 21:09:33
Betreff: ambiguous record field (but not *that* kind of ambiguous record 
field)



Hi all,

On a project I'm working on, I wish to declare something like

data Rec = MkRec { field :: forall a. SomeConstraint a => ... }

where the ... contains no mention of `a`.

Even with https://github.com/ghc-proposals/ghc-proposals/pull/448, I 
think there is no way to avoid the ambiguity when setting `field`. Is 
that correct? If so, what shall we do about it? The natural answer is 
somehow to write ... MkRec { field @a = ... } ... but that would break 
significant new syntactic ground. (Maybe it's good new syntactic 
ground, but it would still be very new.)


Thanks,
Richard___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


ambiguous record field (but not *that* kind of ambiguous record field)

2022-05-16 Thread Richard Eisenberg
Hi all,

On a project I'm working on, I wish to declare something like

data Rec = MkRec { field :: forall a. SomeConstraint a => ... }

where the ... contains no mention of `a`.

Even with https://github.com/ghc-proposals/ghc-proposals/pull/448 
, I think there is no 
way to avoid the ambiguity when setting `field`. Is that correct? If so, what 
shall we do about it? The natural answer is somehow to write ... MkRec { field 
@a = ... } ... but that would break significant new syntactic ground. (Maybe 
it's good new syntactic ground, but it would still be very new.)

Thanks,
Richard___
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs