faylang / fay

A proper subset of Haskell that compiles to JavaScript
https://github.com/faylang/fay/wiki
BSD 3-Clause "New" or "Revised" License
1.29k stars 86 forks source link

Print.hs uses dollar sign "$" which collides with jQuery #476

Open henrylaxen opened 2 years ago

henrylaxen commented 2 years ago

Good evening fay friends,

First I would like to say how much I appreciate the time and effort you have put into Fay. It is such a pleasure to use it and have the Haskell Angel looking over my shoulder when I have to write JavaScript. I have encountered a seemingly rare and mysterious bug today. I will write the offending lines here:


      /*******************************************************************************
       * Application code.
       */

      var $ = Fay$$$;
      var _ = Fay$$_;
      var __ = Fay$$__;

The line that is killing me is var $ = Fay$$$; Why? Because I am using some external jQuery code, and your redefinition of the "$" symbol causes the jQuery "$" to disappear.

This only happens when I enable --pretty-all, and I believe the line responsible for this is line 212 in Print.hs: `

   JsThunk             -> askIf prPrettyThunks "$" "Fay$$$"

` I have an easy workaround, namely remove the --pretty... lines from my Makefile, but I thought you would like to know about this in case it bites someone else. At least if it is listed in your "Issues" others can find it and know how to get around it. Best wishes, Henry Laxen