Skip to content

Replace jQuery with Halogen #199

Closed
Closed
@thomashoneyman

Description

@thomashoneyman

Try PureScript currently relies on the jquery library and some extras defined in JQuery.Extras in this application. It uses these bindings largely in the client/Main.purs file which manages the Try PureScript window and iframe.

There are a few drawbacks to using jQuery:

  • It relies on an imperative approach to updating the editor and application
  • It relies on a set of string selectors without much guidance via types or documentation about what selectors to use to control what behavior
  • (It is my belief that) fewer people in the PureScript community are familiar with using jQuery to write an application like this, versus more common PureScript SPA solutions like React Basic or Halogen.

There are some advantages of jQuery, too:

  • More people know jQuery in general, and so it may be the best option as far as encouraging new contributors
  • jQuery is more stable and changes less frequently than Halogen or React

I think that using jQuery is a net negative for new folks trying to understand Try PureScript and contribute new features to it. Ultimately it’ll be PureScript developers contributing and my sense is that within the community frameworks like React and Halogen are considerably more popular — and while jQuery may be much more widely used and understood than those in general, within the community there are a lot of folks who weren’t web developers before PureScript (like myself) and are not as familiar with things like jQuery.

I also think that the use of jQuery lends to a style of programming that makes this app harder to grow and maintain over time — specifically the imperative style and having to know what a selector means rather than the more PureScript-y declarative nature of React or Halogen.

For these reasons I think we should explore rewriting Try PureScript in either React Basic or Halogen. This rewrite would add no new features and faithfully preserve how Try PureScript currently works, except in the React style or the Halogen style.

(Also — I think it makes sense to switch ContT for Aff at the same time, for ease of development. We’d already agreed that this is worth doing in #179 and it will probably be easier to make both changes together rather than change one at a time.)

I don’t personally prefer React Basic or Halogen over one another, but I think those two are the most widely used and understood of the SPA libraries. I’m a little partial to Halogen as feels nice to use a fully-PureScript framework to write a PureScript core resource like Try PureScript (and then we can use a PureScript-only toolchain), but I understand that React is the more widely understood library.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions