Operating on HsSyn

2017-07-28 Thread Simon Peyton Jones via ghc-devs
Devs, Shayan is working away on "Trees that grow"... do keep it on your radar: To: ghc-devs Sent: 25 May 2017 23:49 Do take a look at this: * We propose to re-engineer HsSyn itself. This will touch a lot of code. * But it's very neat, and will bring big long-term advantages

Re: Operating on HsSyn

2017-07-28 Thread Shayan Najd
Before all this, we may need to discuss a bit about the intended semantics of `Outputable`: does it need to print `PostRn`, or `PostTc` fields; or `Out` suffixed constructors? If not, then we only need to write a set of instances for the base growable AST, once and for all. Such instances will be

RE: Operating on HsSyn

2017-07-28 Thread Simon Peyton Jones via ghc-devs
I have been under the impression that we don't even want to print those. On the contrary, inside GHC I /do/ want to print them. Otherwise how can I see what the renamer has done? Simon From: Shayan Najd [mailto:sh.n...@gmail.com] Sent: 28 July 2017 12:20 To: Simon Peyton Jones Cc: ghc-devs@hask

Re: Operating on HsSyn

2017-07-28 Thread Shayan Najd
> > On the contrary, inside GHC I /do/ want to print them. Otherwise how can I > see what the renamer has done? Right. So if I understand correctly, with this semantics, `Outputable` is somewhere between pretty printing as often used in program manipulation libraries (like Haskell-Src-Exts (HSE))

Re: Operating on HsSyn

2017-07-28 Thread Shayan Najd
by (parser . prettyPrint . parser) = id I meant (prettyPrint . parser . prettyPrint) = id for a valid input. On Fri, Jul 28, 2017 at 4:32 PM, Shayan Najd wrote: > On the contrary, inside GHC I /do/ want to print them. Otherwise how can I >> see what the renamer has done? > > > Right. So

Re: Operating on HsSyn

2017-07-28 Thread Alan & Kim Zimmerman
Well, in GHC as it stands now (from 8.2.1), the original formulation is correct. The current pretty printer does not reproduce layout, but reparsing a pretty printed ParsedSource will faithfully reproduce the original ParsedSource (except for the Locations). This is useful for constructing hsSyn

Re: Operating on HsSyn

2017-07-28 Thread MarLinn
by (parser . prettyPrint . parser) = id I meant (prettyPrint . parser . prettyPrint) = id for a valid input. Simplifying, (parser ∷ String → something), and (prettyPrint ∷ something → String). Therefore, (parser . prettyPrint . parser ∷ String → something) and (prettyPrint . parser

Re: Operating on HsSyn

2017-07-28 Thread Alan & Kim Zimmerman
I agree. 4 is the current GHC invariant. i.e., re-parsing a pretty printed parse tree gives you back a parse tree identical to the original (ignoring SrcSpans) Alan On 28 July 2017 at 20:34, MarLinn wrote: > by > > (parser . prettyPrint . parser) = id > > I meant > > (prettyPrint . parser . p

Re: Operating on HsSyn

2017-07-28 Thread Shayan Najd
MarLinn, Thanks for correcting me, and spelling this out. I did mean what Alan mentioned: "re-parsing a pretty printed parse tree gives you back a parse tree identical to the original (ignoring SrcSpans)". As I recall, we had to go a bit further to give 'Something' some more structure to t

8.2.1: Ord TyCon is gone?

2017-07-28 Thread Levent Erkok
I'm trying to port some plugin code from GHC 8.0.2 to GHC 8.2.1; alas I'm getting an error suggesting that TyCon is no longer an instance of Ord: Data/SBV/Plugin/Analyze.hs:580:33: error: • No instance for (Ord TyCon) arising from a use of ‘M.lookup’ There are instances for similar types