What combination of libraries to provide 2-D graphics, optionally in webapp? (Haskell)

Viewed 429

I am building a simple interactive program with 2D-graphics, and I'd like to know which combination of Haskell libraries are likely to work. My requirements and ideas-so-far are below:

Fundamental requirements:

  • Simple 2-D geometric drawing, of the sort provided by Gloss or Diagrams
  • SVG-style interactivity: For example, playing a jigsaw puzzle or Fifteen Game, be able to click on an object and maybe drag it around the canvas.
    • (Fallback: Use keyboard navigation to move around the image, activate an object, etc)

Induced Requirements:

  • I'd prefer to work in FP Haskell Center, which implies that my UI should be a web app (with Yesod/Snap/Happstack).

If a web app, it could be "image-map" style, where every interaction involves a round-trip to the server, or Javascript style, as with Fay or Elm

Non-requirements:

  • This is a self-contained "toy" (like Tangrams or a jigsaw puzzle), so it doesn't need any persistent state in a database

My ideas:

Can anyone suggest set of packages and architecture style that would likely work well together for this UI? My current ideas are:

  • Yesod with {Gloss or Diagrams} to draw static graphics in FP Haskell Center.

    • Then switch to local development to add local native mouse-click interactivity.
    • Or use some Ajax solution to send click events back to the server to update graphics
  • Elm with reactive graphics, without FP Haskell Center

  • Interactive Javascript experience, written in Fay, compiled to Javascript. (I have never used Fay, I don't know if it can rely on lots of Hackage packages, I know it does not support some extensions, but I don't know if it can use pre-compiled packages that depended on those extensions)

  • Elm and Fay seem similar, the main differences being that:

    • (a) Elm is not actually Haskell
    • (b) Fay doesn't enforce FRP style?

Any recommendations?

1 Answers
Related