Concrete syntax for pattern synonym type signatures

Dr. ERDI Gergo gergo at erdi.hu
Sun Nov 9 03:42:35 UTC 2014


On Sat, 8 Nov 2014, Richard Eisenberg wrote:

> On Nov 8, 2014, at 11:23 AM, "Dr. ERDI Gergo" <gergo at erdi.hu> wrote:
>
>> So we would need to add a way of parsing (T1, T2, ..., Tn; U1, U2, ..., 
>> Um) into a type, which would then require rejecting everywhere else 
>> where we really do mean a type... Sounds painful. Also painful: 
>> rewriting the whole context parsing code :/
>
> I actually think this wouldn't be all that hard. The same 
> parse-as-wrong-AST-node-and-then-fix-it-up-later trick happens in plenty 
> of places, patterns (parsed as expressions) being one of the biggest. 
> Harder than my proposal, probably, but I don't think it's terrible.

Right, but the issue in this case is if we add this artifical constructor 
to HsType just so we can fix it up into a pair of contexts, this 
constructor would permeate everything else that has to do with HsTypes; if 
nothing else, it'd need a `panic "foo: HsContextPair"` branch for all 
type-related renamer/typechecker functions.

Unless I'm missing some shortcut. I hope I do!

Bye,
 	Gergo


More information about the ghc-devs mailing list