Re: Reify and separating renamer+TH from type-checking
Worse, 'reify' is in many cases the very reason why folks are using template-haskell in the first place to build instances or classes based on properties of data types above the splice in the current module. On Fri, Jan 8, 2016 at 2:40 PM, Edward Z. Yangwrote: > I implemented the refactoring to run the renamer and TH splices all > first before doing any type-checking, but actually there's a problem: > Template Haskell splices can call 'reify', which needs the type > information in order to supply the information about the identifiers > in question. I can't think of any good way around this problem. > > Edward > ___ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Reify and separating renamer+TH from type-checking
FYI, metaocaml runs into the same problem [for different reasons]. There the design decision was to not allow using a data-type in the same file as its definition. Separate compilation then solves the problem. This is a minor pain. But in Haskell, this would lead to orphan instances when using TH to derive instances, which is likely to be thought of as a rather bigger pain. Jacques On 2016-01-08 6:08 PM, Simon Peyton Jones wrote: Bother. That's true. And it's a vital feature. Otherwise how do we do data T = T1 | T2 $(makeLenses 'T) So we can't separate the two after all. Sorry -- I totally forgot about that. Very annoying. Simon | -Original Message- | From: Edward Z. Yang [mailto:ezy...@mit.edu] | Sent: 08 January 2016 19:40 | To: Simon Peyton Jones <simo...@microsoft.com> | Cc: ghc-devs <ghc-devs@haskell.org> | Subject: Reify and separating renamer+TH from type-checking | | I implemented the refactoring to run the renamer and TH splices all | first before doing any type-checking, but actually there's a problem: | Template Haskell splices can call 'reify', which needs the type | information in order to supply the information about the identifiers | in question. I can't think of any good way around this problem. | | Edward ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reify and separating renamer+TH from type-checking
I implemented the refactoring to run the renamer and TH splices all first before doing any type-checking, but actually there's a problem: Template Haskell splices can call 'reify', which needs the type information in order to supply the information about the identifiers in question. I can't think of any good way around this problem. Edward ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Reify and separating renamer+TH from type-checking
I think I ran into this issue when we had the Safe Haskell annotation bug, which is why I just disabled annotations for SH. I can't think of a way around it unless we change the TH spec. On 1/8/2016 8:40 PM, Edward Z. Yang wrote: > I implemented the refactoring to run the renamer and TH splices all > first before doing any type-checking, but actually there's a problem: > Template Haskell splices can call 'reify', which needs the type > information in order to supply the information about the identifiers > in question. I can't think of any good way around this problem. > > Edward > ___ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > smime.p7s Description: S/MIME Cryptographic Signature ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
RE: Reify and separating renamer+TH from type-checking
Bother. That's true. And it's a vital feature. Otherwise how do we do data T = T1 | T2 $(makeLenses 'T) So we can't separate the two after all. Sorry -- I totally forgot about that. Very annoying. Simon | -Original Message- | From: Edward Z. Yang [mailto:ezy...@mit.edu] | Sent: 08 January 2016 19:40 | To: Simon Peyton Jones <simo...@microsoft.com> | Cc: ghc-devs <ghc-devs@haskell.org> | Subject: Reify and separating renamer+TH from type-checking | | I implemented the refactoring to run the renamer and TH splices all | first before doing any type-checking, but actually there's a problem: | Template Haskell splices can call 'reify', which needs the type | information in order to supply the information about the identifiers | in question. I can't think of any good way around this problem. | | Edward ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs