Diverk: a Reflex app to browse GitHub repo

I have wanted to learn how to use Reflex for a long time. I find it super exciting to be able to build mobile apps using Haskell. Additionally, FRP as a way to build UIs looked super interesting. I’ve done my fair share of UI development at some point in my career, in C++ for desktop apps tho, but still, I was super curious about this way to address this kind of problem.

I had the chance to have some time lately, plus a small idea that’d be a good fit for a small educational project to get started with Reflex and I wrote Diverk.

That’s a super simple app that allows you to browse and search in the default branch of a GitHub repo. It can render markdown files. I’m a big note taker and all the notes I take live in a private git repo in this format. That was an additional motivation for me to do this project.

To make things even more concrete, I wanted to bring that stuff online and to the Play Store. And so I did, you can try it out very easily if you want. Reflex is an awesome technology. The documentation is there, even if it has a few dark corners. But I think there is a bit of a shortage of concrete examples of real-life yet simple projects like this.

As for my feedback about Reflex, it is quite consistent with what’s been said many many times already. Learning to use FRP is mind-blowing and using Reflex to build UIs is a super enjoyable experience.

23 Likes

That’s awesome, thanks! We really do need more great examples like this!

1 Like

This is super cool. I tried this a few years ago and really liked using reflex. I didn’t go as far as actually finishing my project like you did. So congrats!!

Can you comment on your experience with the Obelisk framework? Like what did you like and what should be improved?

Also, how was the experience of releasing to the play store? I remember just looking through the documentation at the time and found it lacking, although I didn’t actually try. Also, did you try releasing on iOS?

1 Like

I commented on releasing the app on the Play Store in the Reddit thread. TLDR; it is a hassle if you never did it, straightforward if you did it once. I’d love to release it on iOS, but I don’t have an iPhone, so I can’t test it.

Now my opinion on the Obelisk framework.

The most important for me is that statement I wanted to check in the first place, i.e. the promise to have the same code running on the web and Android. It is true, I had zero issues with it and it’s awesome. One can develop on the web, deploy on Android and it behaves the same way, absolutely great. Also, the dev experience, hot reloading with ghci on a file change is super nice.

On the cons side, I’d say that Obelisk is doing too much for my taste. For example:

  • The doc states that Obelisk must be installed. I don’t install dev tools. I use a per-project nix-shell. So what are the advantages of doing it differently?
  • ob shell starts a shell with cabal/GHC in scope, again why not use plain nix-shell?
  • When Obelisk starts, IIUIC, it pulls a pinned version, compiles it, and then runs it. I like the fact that Obelisk is pinned to a specific version but again why not use plain nix for this? It would make the intent clearer and simpler.
  • To deploy the app, one has to create another git repo. I don’t quite get the point. And at the end, it didn’t work for me. I had to do it differently.

Two other remarks:

  • it is sometimes difficult to know where to look at the code when something doesn’t work, as the code is either in the Obelisk repo or in the reflex-platform repo.
  • Obelisk embeds a route library. Why not put it in a separate repo? Also, that library uses a lot of type-level machinery making it difficult to use.

So I would say that Obelisk is very opinionated about how to do things. Personally, I would rather have a simpler tool around a more idiomatic use of nix-shell. And if there are good reasons for Obelisk not to follow common practices, I would love to know about them. But I haven’t found anything along those lines in the docs.

4 Likes

I didn’t go as far as you did with actually finishing my project but I agree with your cons.

Last time I tried this was by just sticking to reflex-platform, not using Obelisk at all. That came with its own challenges of course. Also, at the time I was novice with nix. Maybe I could figure some things out if I tried again.

Thanks for writing that all down!