You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I lost half a night of sleep over the following problem, until I gave up and ran my exam (I know I am daring, but Haste is just too good!) with less functionality than hoped for: In my Main module, I have a big record that contains, among other things, a number of remote $ static (import_ $ ... calls, either directly as fields, or slightly deeper down. I refactored one of these into top-level functions, as I had done previously in other cases successfully, one for the part outside the remote, and one for the remote, and then got run-time errors: With some arrangements:
CalcCheckWeb: too few arguments to remote function
, but mostly
CalcCheckWeb: user error (Pattern match failure in do expression at src/Haste/App/Remote.hs:51:5-12)
I played with this a bit more today: I am only refactoring, and not changing anything, and still get that effect: It works with everything inside the record field, but not after refactoring.
As I have previously observed mess-up when I had #ifdef-ed top-level items present only for GHC, but not for HASTE, I now conjecture that GHC is inlining away my factored-out functions, and producing that same kind of mess-up.
I have not investigated enough to be certain that my explanation is right, but I am seeing “superfluous” top-level definitions all over the Haste/Haste-App source, so there must be something in this direction.
In my opinion, this deserves being documented prominently...
The text was updated successfully, but these errors were encountered:
This does indeed sound like GHC is inlining away the functions, but that shouldn't happen with functions that have a static pointer pointing to them. I think this should be fixed rather than documented.
Does putting NOINLINE pragmas on the affected functions make the problem go away? Do you have a minimal example which triggers this that you're able to share?
I lost half a night of sleep over the following problem, until I gave up and ran my exam (I know I am daring, but Haste is just too good!) with less functionality than hoped for: In my
Main
module, I have a big record that contains, among other things, a number ofremote $ static (import_ $ ...
calls, either directly as fields, or slightly deeper down. I refactored one of these into top-level functions, as I had done previously in other cases successfully, one for the part outside theremote
, and one for theremote
, and then got run-time errors: With some arrangements:, but mostly
I played with this a bit more today: I am only refactoring, and not changing anything, and still get that effect: It works with everything inside the record field, but not after refactoring.
As I have previously observed mess-up when I had
#ifdef
-ed top-level items present only for GHC, but not for HASTE, I now conjecture that GHC is inlining away my factored-out functions, and producing that same kind of mess-up.I have not investigated enough to be certain that my explanation is right, but I am seeing “superfluous” top-level definitions all over the Haste/Haste-App source, so there must be something in this direction.
In my opinion, this deserves being documented prominently...
The text was updated successfully, but these errors were encountered: