Looking for libraries for creating Web Applications in Haskell

Hi everyone!
In our bachelor’s thesis we want to create a visual assistant for creating functions by filling type holes.
This should either be a client-side web application (= SPA) or a Visual Studio Code extension.

We looked into the available libraries for creating web applications and the following seem to be the most fitting libraries that we found:

We would like to know whether anyone from this community can recommend us one of the aforementioned options from personal experience or a different reason?
Or whether you can recommend any other option for creating web applications with Haskell?

Also we would like to know whether you can point us to any examples of VS Code extensions that were built using Haskell or what libraries you would use for something like this?

Thank you so much for your help :slight_smile:

6 Likes

There is always PureScript with Halogen library.

If you insist on doing it in Haskell, there is recent port of Halogen to Haskell: GitHub - Swordlash/haskell-halogen: Port of purescript-halogen to Haskell

5 Likes

Nowadays, you can also use Miso/Reflex (or rather, anything JSaddle-based) with the GHC Wasm backend (so GHC 9.10/9.12):

Also feel free to join the GHC Wasm and Miso Matrix channels!

8 Likes

Does using GHC 9 with miso/reflex only work with the WASM backend and not with the JS backend?
But thanks, this could also be a good possibility that I’ll look into!

For GHCJS: If you’re using GHCup, you need to install the cross channel. You can see the available ghcjs builds. Make sure you get the matching Emscripten version. Then you can invoke cabal-install with the new compiler.

ghcup config add-release-channel cross

git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git checkout 3.1.74
./emsdk install 3.1.74
./emsdk activate 3.1.74
source ./emsdk_env.sh

emconfigure ghcup install ghc --set javascript-unknown-ghcjs-9.12.1
5 Likes

What about something like Hyperbole?

2 Likes

Thanks for the suggestion. Hyperbole looks pretty cool, but it runs on the server and we’d want our program to run completely on the client. So it’s not a good fit for our project.

Thanks for the instructions.
But does this then make it possible to use miso/reflex with the GHC 9 JS backend? Are there afterwards any additional steps needed?
In both of the repositories I find no mention of using the framework with GHC 9 and all of the examples suggest setting it up with nix and then seem to use GHC 8.

git clone https://github.com/dmjio/miso.git
cd miso
cabal build --with-ghc=javascript-unknown-ghcjs-ghc --with-ghc-pkg=javascript-unknown-ghcjs-ghc-pkg --with-hsc2hs=javascript-unknown-ghcjs-hsc2hs todo-mvc
open dist-newstyle/build/javascript-ghcjs/ghc-9.12.1/miso-examples-1.8.7.0/x/todo-mvc/build/todo-mvc/todo-mvc.jsexe/index.html

Note you might need a patch for css to work: Add CSS links to todo-mvc by hasufell · Pull Request #782 · dmjio/miso · GitHub

4 Likes

This works great! Thank you so much :slight_smile:
Is it also so easy for reflex-platform or obelisk? I gave it a try but wasn’t yet successful. A hint into the right direction would be greatly appreciated!

I am currently exploring Servant and Elm. I will say more about this combination later. Servant is supposed to interop nicely with Elm, and Elm’s syntax is very similar to Haskell’s.

I think it will be a win/win.

1 Like

I would strongly recommend against learning Elm in 2025.

There’s been very little communication from the maintainers for years. Compiler development has been stagnant, and trivial bug reports left unresponded to. And while I may have been unlucky with my particular dependencies, it feels like there’s been a major exodus of library maintainers.

I’ve always seen it as a bit of a toy language anyway, with some weird limitations like not being able to use a custom type as the key to a map. The tooling is also slick but basic.

I’ve been using Miso a lot recently, and it’s better in almost every way.

6 Likes

What do you think about PureScript? I’ll check out Miso. And why am I hungry for Japanese food already? LOL

I used PureScript for a work project a few years ago, which then got ported to React+TypeScript due to frustrations with tooling and library availability. It’s a well-designed language, and Halogen is great, but it suffers the effects of having a very small community. I’d be unlikely to reach for it again now that the age of Haskell+WebAssembly is upon us.

5 Likes

I’m wondering: What are the differences/advantages/disadvantages to Haskell+WebAssembly and Haskell+JS? (for example with Miso)

1 Like

I’ve been wondering that myself. No one’s really given me a compelling reason to prefer the JS backend in the long run. The only advantages I can see are that the packaging is simpler for now (which makes it better supported by Nixpkgs, for example), and that it’s easier to port old GHCJS projects.

1 Like