<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-02-21 19:55 GMT+01:00 Richard Eisenberg <span dir="ltr"><<a href="mailto:rae@cs.brynmawr.edu" target="_blank">rae@cs.brynmawr.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div>As I understand pattern and expression contexts are always separate in Haskell so the part just after 'of course' is not clear to me.</div></div></div></blockquote><div><br></div></span><div>Sadly, this is not true. We don’t always know whether we’re parsing an expression or a pattern. Specifically, imagine this prefix of a Haskell definition:</div><div><br></div><div>foo = do</div><div>  Just x</div></div></div></blockquote><div><br></div><div>Ah yes, partial parses. I did not think about this.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div>With -XTypeApplications, GHC lexes ‘ @‘ and ‘@‘ separately.</div></div></div></blockquote><div><br></div><div>For the record:</div><br><font face="monospace, monospace">GHCi, version 8.0.2: <a href="http://www.haskell.org/ghc/">http://www.haskell.org/ghc/</a>  :? for help<br>Prelude> :set -XTypeApplications <br>Prelude> let f x@Nothing = print x in f Nothing<br>Nothing<br>Prelude> let f x @Nothing = print x in f Nothing<br><interactive>:3:5: error: Parse error in pattern: f x @Nothing<br>Prelude> let f x@ Nothing = print x in f Nothing<br>Nothing<br>Prelude> let f x @ Nothing = print x in f Nothing<br><interactive>:11:5: error: Parse error in pattern: f x @Nothing</font></div><div><font face="monospace, monospace">Prelude> :set -XNoTypeApplications <br>Prelude> let f x@Nothing = print x in f Nothing<br>Nothing<br>Prelude> let f x@ Nothing = print x in f Nothing<br>Nothing<br>Prelude> let f x @Nothing = print x in f Nothing<br>Nothing<br>Prelude> let f x @ Nothing = print x in f Nothing<br>Nothing<br></font><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div>Perhaps the ghc-proposals process will bring such problems to light sooner. I’m sorry our design decisions here have caused trouble!<br></div></div></div></blockquote><div><br></div><div>As I understand keeping Language Report full up to date is a lot of work, but keeping just the sections about Lexing and Parsing up to date should be a part of ghc-proposals in my opinion, so that independent tools have information to rely on.<br></div><div><br></div></div><div>-- </div><div>Gracjan</div><div><br></div></div></div>