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

Joachim Breitner mail at joachim-breitner.de
Mon May 16 20:22:07 UTC 2022


Hi,

Am Montag, dem 16.05.2022 um 19:09 +0000 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
  mail at joachim-breitner.de
  http://www.joachim-breitner.de/



More information about the ghc-devs mailing list