<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello devs,<br class=""><br class="">I am trying to modify GHC's parser to allow the following syntax in types:<br class=""><br class="">  a -> @m b<br class=""><br class="">but my naive attempt was unsuccessful:<br class=""><br class="">type :: { LHsType GhcPs }<br class="">        : btype                        { $1 }<br class="">        | btype '->' PREFIX_AT btype ctype  ...<br class=""><br class="">For example when I try to parse the following code (and turn on the lexer debug log):<br class="">  <br class="">  test :: a -> @m b<div class="">  test = undefined<br class=""><div class=""><br class=""></div><div class="">I get the following <br class=""><br class=""><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class="">token: ITvarid "test"</div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITdcolon NormalSyntax</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITvarid "a"</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITrarrow NormalSyntax</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITtypeApp</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITvarid "m"</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITvarid "b"</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">token: ITsemi</span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); min-height: 14px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">Parse.hs:2:1: </b></span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class=""><b class="">error:</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">    parse error (possibly incorrect indentation or mismatched brackets)</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(64, 11, 217);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><b class="">  |</b></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #400bd9" class=""><b class="">2 |</b></span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #b42419" class=""><b class="">t</b></span><span style="font-variant-ligatures: no-common-ligatures" class="">est = undefined</span></div></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div></span><span class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-family: Helvetica;" class=""><br class=""></span></div></span><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-family: Helvetica;" class="">I don't have much experience with hacking on the parser so I'm likely missing something obvious.</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class="">Could someone please point at what I might be doing wrong?</div></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class="">Thanks in advance.</div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class="">Cheers,</div><div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(0, 0, 0);" class="">Csongor</div></body></html>