Alternatives to jupyter notebooks for haskell

Are there alternatives to jupyter notebooks for haskell?
I can’t even install jupyter for haskell on my computer. And also it supports a limited number of ghc versions.
I would also like to compile cells in an optimized way, since unoptimized ghci code is often too slow.
Is there something that allows this to be done?

You may like to try jupyenv - GitHub - tweag/jupyenv: Declarative and reproducible Jupyter environments - powered by Nix - but it can be a bit of a journey if you’re not super into nix :slight_smile:

As to your question about compiled cells; I suspect that isn’t possible; but I wouldn’t be too concerned because, surely, once you are happy enough with the gist you can transfer that code into it’s own library/executable. But I agree it could be nice.

Note that this is actually a moderately common workflow in Python notebooks; converting notebook code into library code and using something like autoreload; of course, the same is not possible in Haskell, as far as I know.


Cocalc has both free and paid tiers of online development environments including haskell with jupyter:

1 Like

Hot code reload is certainly possible.

1 Like

Emacs org-mode with org-babel is a great solution but you have to learn new technologies if you don’t already know them of course.


This is a great question. I’ve played a lot with IHaskell. What I found is that it’s amazing when it works, but it often doesn’t work at all. Especially if you want to use notebooks as documentation in an existing project, or as a fancy cabal repl.

To answer the title question, this is what I ended up doing instead:

  • Combine regular cabal repl with some dirty modules. The idea is that you can use HLS to write some quick and dirty functions that you can then evaluate using cabal repl. Kind of like writing quick scripts.
  • writing some code examples in Haddock comments. HLS can pick those up and offer to evaluate them. You can even run a doctest that evaluates all functions’ Haddock codes to make sure the output is still as expected. That’s basically jupyter notebooks, but with an entirely different purpose
  • Literate Haskell files, which combine markdown or LaTeX with runnable Haskell code. This is a good idea for papers and for documents that independently explain a concept. I haven’t tried Literate Haskell files that import from a cabal project.
1 Like

I just use ghcid --test "main" for when I write webdev stuff!