Yeah. Esp once fancy stuff like Rhyolite gets into the mix, it's hard to think about using anything else anymore. I'd miss being able to write correct UI abstractions and not have to worry about magic breaking. :slight_smile:
How do I use reflex-vty as a Nix dependency? The nixpkgs entry is broken so I downloaded it from github, now what exactly should I put in the overrides? I've tried using release.nix but it's not working and I'm not sure what it even does.
I'm using Nix to manage dependencies and Cabal to build my packages inside a Nix shell. This package is marked as broken in nixpkgs (as reflex-related packages normally are) so I've tried t...
A project template for writing modern web apps in reflex (database, websocket, real-time notifications, live reload, etc): https://github.com/3noch/something
This is a pretty awesome repository - I was trying to use and adapt obsidiansystem's rhyolite for a while but failed (not good enough in Haskell yet to figure out how to combine all the pieces to get a nice chain from backend to frontend ; especially failing on the functorToWire for the Query... I got something compiling but then making sense out of having to implement a Filterable instance etc. made me giving up). Sadly this repo is not mentioned in the rhyolite lib nor anywhere else :see_no_evil: . So thanks @Sridhar Ratnakumar , it's worth a lot to me :) .
Yea, it is a matter of creating a 'Rhyolite' zettel and linking it accordingly. Well, rhyolite provides features _still_ missing in obelisk: database notifications, websocket support, real-time communication (and database notifications going to browser through Dynamic, aka. ViewSelector), etc..
So - after hooking up everything, i.e. handlers and models and all - for example you use queryDyn in the frontend to request an interest in a certain set of data. In the backend you then provide these data and even update this set of data automatically on change (which is done via PostgreSQL 's NOTIFY and LISTEN). So you kind of get real-time updates for your queries (similar to what Meteor is doing https://www.meteor.com/).
But this is only one example, I guess. Rhyolite is a kind of collection of yet-to-polish stuff for obelisk :) . But the feature just mentioned is what I am really interested in :).
Rhyolite is not publicly talked about for good reason! Not because it's a secret but more that it's a bit crufty and unpolished, and due to be replaced with something better (technically and in terms of polish) this year. :slight_smile:
Rhyolite is not publicly talked about for good reason! Not because it's a secret but more that it's a bit crufty and unpolished, and due to be replaced with something better (technically and in terms of polish) this year. :slight_smile:
That's good to hear. What more can you tell about the new thing? Ve...? :-)
It's not a secret. There was a zurihac talk on it that unfortunately got lost. And then an internal OS talk on it where the footage also got lost. Cursed.
It's called incremental view, and it involves a rhyolite like thing with a lot more automation of mapping the changes to the db and back out rather than the manual writing of selectors and handlers.
Ah, cool. So is it using WAL of Postgres to achieve this? (can't remember the zurihac talk in detail). Can't wait to explore this, let us here if there is some time-line (so anything before 31.12. :D)
Yes I work for OS now. And not yet. It's being developed internally atm and will be released when it is ready for public consumption (and will be FOSS just like reflex).
Depending on whether you are going to be using jsaddle at all for dev, you can either use the jsaddle-dom stuff to interact with stuff it has generated apis for or exec raw JS calls in JSM.
If you aren't using jsaddle and always compiling with ghcjs, you can just use GHCJS FFI to javascript.
This all sounds really hard. But anyway i dont actually ahve a direct need for what I am asking, maybe it is unncessary. I just was hoping to be able to check the box that its possible. Maybe I can hack something together though that would allow me to send/call my haskell code from JS
This all sounds really hard. But anyway i dont actually ahve a direct need for what I am asking, maybe it is unncessary. I just was hoping to be able to check the box that its possible. Maybe I can hack something together though that would allow me to send/call my haskell code from JS
I guess this is not exactly what you are asking for, but just for the record: google-maps-reflex does "call a hs function" from JS, which results in an Event in the reflex application. See https://github.com/cfraz89/google-maps-reflex/blob/master/src/GoogleMapsReflex/MapsLoader.hs . That's due to the fact that when you include the Google Maps script, you attach a callback name of the global JS scope which is called as soon as the script is loaded/ready.
Yeah the complication there is understanding what jsaddle is doing for you, not using it yourself. It's not very documented, so it's pretty weird. That example is using jsaddle so you can easy drop that into an obelisk app. It's just things that to a foreign import of js code that you have to be wary of. As a user it's no harder to use than the existing GHCJS Dom bindings (because they are generated from the same source data) but you should definitely seek to understand this before putting jsaddle code in production apps just so that you are aware of things in case anything breaks weirdly in development when using jsaddle warp.
I worked for Obsidian in the past, but continue to use Obelisk in hobby projects. Can't imaging using anything else (like Elm or PureScript).
Yeah. Esp once fancy stuff like Rhyolite gets into the mix, it's hard to think about using anything else anymore. I'd miss being able to write correct UI abstractions and not have to worry about magic breaking. :slight_smile:
Or Elm's verbosity. It's hard to write incorrect elm code, but it does get pretty verbose without all of the nice types.
When it comes to CSS, what is the preferred way to develop CSS with reflex app?
I like Clay, but I don't think that there is a universally preferred way.
Are there examples/docs for how to do JS->HS and HS->JS FFI with ghcjs yet?
JS->HS https://github.com/obsidiansystems/reflex-dom-plaid/blob/master/reflex-dom-plaid/Reflex/Dom/Plaid/Link.hs
How do I use reflex-vty as a Nix dependency? The nixpkgs entry is broken so I downloaded it from github, now what exactly should I put in the overrides? I've tried using
release.nix
but it's not working and I'm not sure what it even does.EDIT: Figured out. https://github.com/reflex-frp/reflex-vty/issues/18
A project template for writing modern web apps in reflex (database, websocket, real-time notifications, live reload, etc): https://github.com/3noch/something
This is a pretty awesome repository - I was trying to use and adapt obsidiansystem's rhyolite for a while but failed (not good enough in Haskell yet to figure out how to combine all the pieces to get a nice chain from backend to frontend ; especially failing on the
functorToWire
for theQuery
... I got something compiling but then making sense out of having to implement aFilterable
instance etc. made me giving up). Sadly this repo is not mentioned in the rhyolite lib nor anywhere else :see_no_evil: . So thanks @Sridhar Ratnakumar , it's worth a lot to me :) .What is Rhyolite even? Is there any documentation?
It's mentioned in my Haskell zettelkasten :smiley: https://haskell.srid.ca/2012401.html
Yeah well it doesn't say what it is for...
Yea, it is a matter of creating a 'Rhyolite' zettel and linking it accordingly. Well, rhyolite provides features _still_ missing in obelisk: database notifications, websocket support, real-time communication (and database notifications going to browser through Dynamic, aka. ViewSelector), etc..
So - after hooking up everything, i.e. handlers and models and all - for example you use
queryDyn
in the frontend to request an interest in a certain set of data. In the backend you then provide these data and even update this set of data automatically on change (which is done viaPostgreSQL
'sNOTIFY
andLISTEN
). So you kind of get real-time updates for your queries (similar to what Meteor is doing https://www.meteor.com/).But this is only one example, I guess. Rhyolite is a kind of collection of yet-to-polish stuff for obelisk :) . But the feature just mentioned is what I am really interested in :).
@Matthias Putz Exactly. Could I steal your words for my Zettelkasten? :-D
:D - for sure ;).
Amazing!
Rhyolite is not publicly talked about for good reason! Not because it's a secret but more that it's a bit crufty and unpolished, and due to be replaced with something better (technically and in terms of polish) this year. :slight_smile:
If you've got something to write right now, go for it, but I wouldn't learn rhyolite "just for funsies" right now unless you have an immediate use. :
Ben Kolera said:
That's good to hear. What more can you tell about the new thing? Ve...? :-)
It's not a secret. There was a zurihac talk on it that unfortunately got lost. And then an internal OS talk on it where the footage also got lost. Cursed.
It's called incremental view, and it involves a rhyolite like thing with a lot more automation of mapping the changes to the db and back out rather than the manual writing of selectors and handlers.
There are lots of bugs that you make in rhyolite apps. This is trying to move towards fixing that.
Great to see the ecosystem around Reflex growing, it really feels like the right way
Ah, cool. So is it using WAL of Postgres to achieve this? (can't remember the zurihac talk in detail). Can't wait to explore this, let us here if there is some time-line (so anything before 31.12. :D)
@Ben Kolera Do you work for Obsidian now? Is there a repo for incremental view? Or is it this one: https://github.com/obsidiansystems/vessel
Yes I work for OS now. And not yet. It's being developed internally atm and will be released when it is ready for public consumption (and will be FOSS just like reflex).
Oh, and the reason for this is that it'll actually be proper part of obelisk. :slight_smile:
So is there any documentation/examples of how to call/invoke a HS function from JS?
you want to write native js in a reflex app?
I want to be able to interact with my haskell application if I need to
I'm just starting out but my understanding is that you can access all dom events from your haskell app
so i mean the issue is if I have some external component and it needs to invoke a fn call
right, I think I saw a link about using external js somewhere
Depending on whether you are going to be using jsaddle at all for dev, you can either use the jsaddle-dom stuff to interact with stuff it has generated apis for or exec raw JS calls in JSM.
If you aren't using jsaddle and always compiling with ghcjs, you can just use GHCJS FFI to javascript.
If you are doing obelisk or r-p, you are probably wanting jsaddle. GHCJS compiles can be slow enough to dodge them for development.
I find it pretty hard to get a grasp of how all of those components relate to each other
Yeah, it's a right PitA because there's next to no doco. :frown:
yeah the missing docs are really frustrating
With obelisk it has jsaddle built in though. You can't use FFI js there so if you go that route only bother looking at JSM and Jsaddle.
This all sounds really hard. But anyway i dont actually ahve a direct need for what I am asking, maybe it is unncessary. I just was hoping to be able to check the box that its possible. Maybe I can hack something together though that would allow me to send/call my haskell code from JS
Joel McCracken said:
I guess this is not exactly what you are asking for, but just for the record: google-maps-reflex does "call a hs function" from JS, which results in an
Event
in the reflex application. See https://github.com/cfraz89/google-maps-reflex/blob/master/src/GoogleMapsReflex/MapsLoader.hs . That's due to the fact that when you include the Google Maps script, you attach a callback name of the global JS scope which is called as soon as the script is loaded/ready.Yeah the complication there is understanding what jsaddle is doing for you, not using it yourself. It's not very documented, so it's pretty weird. That example is using jsaddle so you can easy drop that into an obelisk app. It's just things that to a foreign import of js code that you have to be wary of. As a user it's no harder to use than the existing GHCJS Dom bindings (because they are generated from the same source data) but you should definitely seek to understand this before putting jsaddle code in production apps just so that you are aware of things in case anything breaks weirdly in development when using jsaddle warp.