Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove broken bind/append functions #72

Merged
merged 1 commit into from
Nov 2, 2016

Conversation

charleso
Copy link
Contributor

This may be a little controversial. I noticed this after seeing @MichaelXavier issue #71.

Basically when using bind for Html it creates an array instead of a new Element value. This then falls through on the Functor instance here. It would also, I'm fairly sure, break if it was the top-level Html (not tested though).

The alternative to this PR is having to add/maintain support for Html being either an Element, Class and an array of Html. I would argue this is just going to make it harder to support and increase the number of edge cases.

The downside which this PR is that you can no longer use the do syntax for Html, which is certainly nice to use, but I would argue better than increasing the complexity of the pux internals.

Thoughts?

@MichaelXavier
Copy link
Contributor

I'll comment here. I filed #71. While I still don't fully follow exactly how things broke down, I took code that was reproducibly failing, purged all monadic rebinding (I realize now it isn't actually a monad) for Html in favor of # ## and friends and no more runtime pattern match exception. Overall it is pretty easy to upgrade monadic Html code to use the helpers and doesn't look much worse in my opinion, has fewer edge cases (e.g. it seems impossible to have a childless element in the monadic form). Seems like this feature can be pretty dangerous. I was able to get through several components in my little project over the course of a few weeks before it manifested as a runtime pattern match error and I was unable to get to the bottom of it with the chrome debugger.

Does Purescript support deprecation pragmas? If people are onboard with removing the feature maybe it would be prudent to put it behind a deprecation warning for 1 release. As for me, I'm going to just make a mental note to not use the feature as its unsafe.

Thanks for looking into this @charleso and solving the mystery. It was really driving me crazy.

@alexmingoia alexmingoia merged commit 7ed61e4 into alexmingoia:master Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants