HeinrichApfelmus / threepenny-gui

GUI framework that uses the web browser as a display.
https://heinrichapfelmus.github.io/threepenny-gui/
Other
439 stars 77 forks source link

With out this patch loading the a the page in the below example results ... #59

Closed Davorak closed 10 years ago

Davorak commented 10 years ago

With out this patch loading the a the page in the below example results in the

following error:

getByETest.hs: user error (Pattern match failure in do expression at src/Graphics/UI/Threepenny/Core.hs:143:5-15)

The same problem exists with all getElement functions as far as I can tell.

example code that demoenstrates this problem can be found at the following paste http://lpaste.net/95800

This fixes an error found on os: 10.8.5 ghc: 7.6.3

I have also posted to SO for further insight it does not seem like I should expect a difference between pattern matching in do notation vs let.

http://stackoverflow.com/questions/20026610/pattern-matching-in-do-notation-vs-let

HeinrichApfelmus commented 10 years ago

Thanks a lot for the report!

Turns out that this is essentially the same issue as #60.

Unfortunately, while your patch solves the immediate crash, I don't think that it solves the whole issue: It occurs to me that version 0.3 has a fundamental problem with garbage collection of elements when using a custom HTML file. The problem is that I want to represent all DOM elements on the server side in order to use the Haskell runtime to keep track of garbage. However, the server currently only keeps track of DOM elements that it has created itself, and ignores all those in a custom HTML file.

The only workaround I can think of right now is to create the HTML DOM via the UI.div combinators etc. Sorry about that!

Davorak commented 10 years ago

I was going to surprised if my hack, was a complete solution to the problem, but it seemed worth sharing nonetheless.

Thanks for the details and explanation of where the issue is arising from.

HeinrichApfelmus commented 10 years ago

Unfortunately, a full solution to this problem is a bit more elaborate and won't make it into the upcoming version 0.4. Furthermore, the internals have changed so much that this pull request no longer applies. I would like to close it and continue discussion in #60.