GHC 8 and Template Haskell

Iavor Diatchki iavor.diatchki at gmail.com
Thu Apr 14 21:11:26 UTC 2016


Hi,

objection!  :-)

If we were to delay things, we would ship a version of the library that has
missing functionality *and* we'll break everyone's code on the next
release.   If we make the change now, then at least when people fix their
TH code to work with GHC 8, they'd be getting access to more functionality.

This change does indeed change the data structure for declarations, so if
you were working with it directly, indeed you'll have to make changes.
However, if you use the "smart" constructors in TH, you shouldn't need to
change anything.
In particular, I left `instanceD` as before---it does not add any
overlapping pragmas, and I added a new function `instanceWithOverlapD`,
which has an extra parameter that allows you to specify pragmas.

I'd like to get this in, if possible, as I have a library that needs this
feature.  My current work-around it quite ugly:  ask the clients of the
library to enable "Language OverlappingInstaces", which is cumbersome,
*and* generates deprecation warnings.

-Iavor






On Thu, Apr 14, 2016 at 1:59 PM, Richard Eisenberg <eir at cis.upenn.edu>
wrote:

> I'm happy to be overruled on this, but I vote against this change for GHC
> 8. Personally, I like to have a policy of "no TH changes after the first
> RC". This gives ample time for TH clients to update their code. Iavor's
> suggestion would likely involve a new part of the InstanceD constructor,
> which would affect anyone constructing or matching on this constructor. If
> the change involved, say, only adding new functionality without changing
> anything existing, I would be more willing to include for GHC 8.
>
> And, yes, I agree with Austin.
>
> Richard
>
> On Apr 14, 2016, at 2:17 PM, Austin Seipp <austin at well-typed.com> wrote:
>
> > Here's a question, on top of this one: why don't we require
> > template-haskell changes for most corresponding syntax changes? We
> > tend to play catch up with template-haskell sometimes and it's
> > relatively strange. I mean, in some sense, we could have said a while
> > back "This needs another revision, please add template haskell
> > support" and avoided it all.
> >
> > Richard has a better insight into this than I do, I'm sure, but it
> > seems - to me, anyway - like template-haskell support is a reasonable
> > bar for most surface-level syntax change to cross, before getting
> > merged.
> >
> > My intuition tells me that, most of the time, a lot of us simply
> > forget to make the changes, or ask for them in reviews, and so it
> > goes.
> >
> > On Thu, Apr 14, 2016 at 1:12 PM, Ben Gamari <ben at well-typed.com> wrote:
> >> Iavor Diatchki <iavor.diatchki at gmail.com> writes:
> >>
> >>> Hello,
> >>>
> >>> Now that "OVERLAPPING" and "OVERLAPPABLE" are pragmas on the
> instances, do
> >>> we have a way to generate instances with such pragmas using Template
> >>> Haskell?   I can't seem to find a way to do this, which is unfortunate.
> >>>
> >>> If I am not missing anything, would there be objections to adding it
> to the
> >>> TH library before the next release---I would volunteer to do the change
> >>> ASAP.
> >>>
> >> Indeed this is an unfortunate gap. Given that this shouldn't be a
> >> terribly invasive change I would be alright with this if Richard
> approves.
> >>
> >> Cheers,
> >>
> >> - Ben
> >>
> >>
> >> _______________________________________________
> >> Libraries mailing list
> >> Libraries at haskell.org
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >>
> >
> >
> >
> > --
> > Regards,
> >
> > Austin Seipp, Haskell Consultant
> > Well-Typed LLP, http://www.well-typed.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160414/3cb64255/attachment.html>


More information about the ghc-devs mailing list