Obelisk - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Torsten Schmits

Are there many people here using Obelisk or Reflex?

Joel McCracken

I want to make a project of this, I was thinking of doing so this weekend

Torsten Schmits

I spent the last week adapting the build of my project to Obelisk. I find it (and the reflex-platform build) to be unnecessary convoluted, but I've figured most of it out now. Would be interested in hearing some other opinions

Joel McCracken

Purescript works really well too.

Sridhar Ratnakumar

My GitHub has some obelisk projects

Ben Kolera

Yeah, I pretty much use obelisk for all my reflex these days. Having the frontend routing and typesafe static file handling all sorted for you is nice enough win as it is. Some semblance of server side rendering is also nice.

Torsten Schmits

do you customize the build a lot?

Ben Kolera

What kind of customisation? Haskell overrides? Yeah that's pretty normal.

Torsten Schmits

I find myself needing much deeper changes, examples being the use of base-noprelude and having includes and defaults in my hpack files. I reimplemented the whole ghcid ob run setup in nix…I think it would be more sensible to separate the web component from the rest of the project and sticking to the frontend/backend/common structure

Torsten Schmits

ghcide and docker support are also currently fresh in experimental branches, I use both but it needs a lot of tweaking

Ben Kolera

No webserver is basically reflex-platform.

Ben Kolera

Just without the cli tool to run it.

Ben Kolera

But yeah. Obelisk is opinionated. If you have different opinions, you'll probably have to peel things back and roll your own.

Torsten Schmits

I'd say it's possible to be opinionated and still keep the build nix expressions flat enough for people to slightly deviate from the default without contortions :smiley:

Torsten Schmits

what do people use to fetch data from the backend? I've seen servant-reflex but I'm wondering if there's anything built into obelisk?

Torsten Schmits

intravenous? please elaborate, @Sridhar Ratnakumar :smiley:

Sridhar Ratnakumar

@Ben Kolera How much permission do we have from Obsidian as to talking more about it? :-)

Torsten Schmits

does everyone here work at Obsidian? :joy:

Sridhar Ratnakumar

One thing I can tell right now is that it is going to be awesome.

Torsten Schmits

well now I want to know more

Torsten Schmits

so I'll have to stick with servant-reflex until Untitled Mystery Project IV is released?

Sridhar Ratnakumar

One thing I'd like to do today is to use something like Firebase, so I can write my SPAs without bothering to setup backend. There is https://github.com/JBetz/reflex-firebase

Firebase bindings for reflex-dom. Contribute to JBetz/reflex-firebase development by creating an account on GitHub.
Sridhar Ratnakumar

Like, if I want to quickly prototype a small app to count workout reps for myself I can just spin up an obelisk project template pre-using reflex-firebase and finish it a couple of hours.

Sridhar Ratnakumar

I think it would be a good template repository. You can remove ./backend and ./common and simplify things a lot.

Matthias Putz

Torsten Schmits said:

well now I want to know more

me waiting for some more info on this as well :D - since it was mentioned in the Reflex-FRP already, I spoil here (not working for obsidian :D): IV stands for incremental view and it was also already presented in a zurihac talk by Ryan (and another talk, both lost :/ and my memories also lost despite I liked the zurihac talk :D). But it is not official yet, so we have to be patient.

Ben Kolera

@Sridhar Ratnakumar yeah I do. No need to be secretive about IV. It'll be public when its ready, but there is a long process going on hidden to make sure that it is ready so that we don't release something and then whipsaw people having to make drastic changes to it later. It's getting there, but it's definitely still experimental. It's not as dependent on vessel as you'd think.

Ben Kolera

There has been two talks on it, but it is cursed and somehow both talks lost their video.

Ben Kolera

I'm not on the IV team so I can't make such calls. But my guess would be that it is still a bit early for alpha testers. :slight_smile:

Ben Kolera

I think right now it is being internally alpha tested sorting out the memory leaks, getting the api good, etc.

Sridhar Ratnakumar

Experimental ghcide support https://github.com/obsidiansystems/obelisk#experimental-ghcide-support

Obelisk provides an easy way to develop and deploy your Reflex project for web and mobile - obsidiansystems/obelisk
Torsten Schmits

yup, works pretty well for me

Torsten Schmits

I have a weird situation with ghcide and neovim, maybe one of you has an idea: when ghcide starts while I have a haskell file open, its cwd is set to the root of the module (e.g. frontend), and it looks for hie-bios.sh there. if the currently edited file is of another type, the project root is cwd.

Sridhar Ratnakumar

https://github.com/srid/obelisk-rhyolite-template

A template repository for your Obelisk+Rhyolite projects - srid/obelisk-rhyolite-template
Matthias Putz

Sridhar Ratnakumar said:

https://github.com/srid/obelisk-rhyolite-template

You are doing great stuff here Sridhar! :) ... meanwhile I did, based on the something project, use rhyolite to show a map, put pins on it, move them around -- and replaced beam with persistent (didnt like the API too much :) ). Let's see if I can convince a customer to use it, otherwise I will make it available as well :D .

Matthias Putz

Matthias Putz said:

Sridhar Ratnakumar said:

https://github.com/srid/obelisk-rhyolite-template

You are doing great stuff here Sridhar! :) ... meanwhile I did, based on the something project, use rhyolite to show a map, put pins on it, move them around -- and replaced beam with persistent (didnt like the API too much :) ). Let's see if I can convince a customer to use it, otherwise I will make it available as well :D .

But having been briefly in the latest video chat and hearing the not motivating example by one the guys, I assume this will probably also happen to me :D :D (but dont want to change the topic here ;) )

Matthias Putz

Sridhar Ratnakumar said:

https://github.com/srid/obelisk-rhyolite-template

Quick question: For deploying to AWS I would need the real connection string to an RDS - Is there some nix/obelisk way to set an env var so the app knows what to connect to? So assuming release.nix is there for some reason.

Ben Kolera

Be a little careful with rhyolite and it's public but purposefully not publicised state. It will end up being deprecated by IV sometime soonish so I wouldn't use rhyolite in a work project. But it's definitely a fun experience to see how well a QueryT / RequeserT based reflex app can work.

Ben Kolera

The configuration like that is wrapped up in ob deploy @Matthias Putz .

Ben Kolera

If you grab the configuration from the obelisk config, then when you deploy an obelisk app you can give it config then.

Ben Kolera

And if you don't like beam, you're gonna hate IV, lol.

Matthias Putz

Ben Kolera said:

And if you don't like beam, you're gonna hate IV, lol.

thanks for the hint regarding deployment and the primer regarding IV+beam :D , maybe I switch back to beam :D :D (no wasted time so far, I am learning a lot along the road). But I assume beam is just the preferred choice but not necessarily hard wired to IV?
Any primer on "how hard" to switch to IV from the Rhyolite way?
"Soonish" is a little bit to far away, guess I need to make my point pretty soon. The better if the proper solution comes somewhere on the way :D .

Ben Kolera

Yeah, that's why I'd advise caution. There's no real way to know whether rhyolite is deprecated next month or next year at this point. But it was already a bit of an unpolished tool box of bits to add onto Obelisk and it'll certainly get worse if Obsidian things move on, lol.

It's going to be a big shift. Instead of writing your view selectors and notification handlers yourself IV knows way more about the database and being able to push updates into the db and let other things know what changed. Beam isn't irreparably baked in there, but it is the first thing that was targeted because it was deemed the most appropriate. You could write another thing, but that could be a lot of work. You certainly wouldn't do that while you were learning the thing.

I don't really know how big of an effort the migration would be given I'm only following IV from the outsides, but I'd think that it would be safe to say that if your model was already in beam rather than esqueleto, it'd be a whole lot easier.

Ben Kolera

If your backend model was in beam, I'd say expect to have to learn a bunch of stuff and rewrite everything in your view selectors / notify handler and request handler.

Ben Kolera

Probably also some tweaks to frontend types too, but it's probably a lot the same just sending a query and requests.

Sridhar Ratnakumar

@Ben Kolera I was there when the chess app was being demo'ed (this was last year I think), but I don't know how far IV has progressed since then.

Ben Kolera

It was all in Ryan's head for a long time after that, but it has recently (a few months) exited out of that state and there are a bunch of people on it. But there's the long road of making it fast, fixing memory leaks, getting it nice to use, etc.

Sridhar Ratnakumar

I imagine Cale Gibbard might have had his hand in it as well, as he usually does in the various projects and libraries at Obsidian. Man, I enjoyed pairing with Cale even if only briefly. One of the things I miss right now.

Torsten Schmits

Torsten Schmits said:

I have a weird situation with ghcide and neovim, maybe one of you has an idea: when ghcide starts while I have a haskell file open, its cwd is set to the root of the module (e.g. frontend), and it looks for hie-bios.sh there. if the currently edited file is of another type, the project root is cwd.

FYI! problem was that package.yaml was in coc.nvim's rootPatterns config option, and the subpackage contained one of those.

Sridhar Ratnakumar

I can haz some feedback on this draft blog post on obelisk? https://www.srid.ca/fa9766e6.html

Torsten Schmits

why is ob run like ghcid when it actually uses ghcid?

Sridhar Ratnakumar

Good catch; I guess I was thinking of the reflex-ghci port, which has not been released yet. Fixed

Torsten Schmits

you're using the term "git rep", is that an abbreviation I've missed so far or did you intend to write "repo"? :smile: