sanctuary icon indicating copy to clipboard operation
sanctuary copied to clipboard

Open source projects built with sanctuaryjs

Open andrei-cacio opened this issue 6 years ago • 8 comments

Hi there, I am looking for some more complex examples of near real-world projects/anything built with sanctuary. Can someone point me to some nice repos?

Kind thanks and big kudos up for this wonderful library!

andrei-cacio avatar Jul 12 '18 06:07 andrei-cacio

I have been pointing people to generate, the script used to generate the Sanctuary website from the project's documentation, but I imagine you're hoping to see some asynchronous computations. I don't have a suitable project to share, but I invite the community to pitch in. I believe @Avaq and @dakom may be able to help here.

Kind thanks and big kudos up for this wonderful library!

Thank you for the kind words. :blush:

davidchambers avatar Jul 15 '18 16:07 davidchambers

I'm humbled to be in the same sentence as @Avaq since pretty much all the JS/TS async stuff I'm doing is just passing around Flutures :)

Wish I could share it as example but my dayjob project is closed source... one thing I'll say is that the semantics of Sanctuary and Fluture just outright prevent entire classes of bugs that are super easy to accidentally create otherwise, and it's really a pleasure knowing that I'm building on a solid foundation.

One open source thing that I have which might be worth a peek is this little thing I released a few weeks ago: https://github.com/dakom/ball-bounce-frp

Gotta give it time to load since there's a bunch of heavy graphics. Almost the entire logic is in this file: https://github.com/dakom/ball-bounce-frp/blob/master/src/app/worker/frp/Ball-FRP.ts

As you can see it makes very heavy use of Sanctuary's Maybe and map :) Without that, there would be much more noise like if(bounceHasStarted) or if(bounceHasFinished) etc. The FRP lib I used also has the fantasy-land stuff added to it so there's a lot of power lurking under the hood (though just a heads up - the FRP lib I used does have an outstanding bug... and I don't want to derail the conversation here into that).

Though honestly I think we're kindof just seeing the beginning of a new revolution and the real mind-blowing stuff is still around the corner. It's only a matter of time before people really start looking at how to write functional JS to stay sane while scope of web apps blows up, especially with the growing popularity of frameworks like React that heavily lean on some of the same principles.

dakom avatar Jul 15 '18 16:07 dakom

I would love to see a React app written with SanctuaryJS :)

Also thank for the examples, it is a great start !

andrei-cacio avatar Jul 17 '18 10:07 andrei-cacio

If you don't mind, I would like to keep the issue open, maybe others will chip with examples.

andrei-cacio avatar Jul 17 '18 10:07 andrei-cacio

Here's a minimal example using Sanctuary with React: https://codesandbox.io/s/8kwpv0r3w9

It may not seem all that big of a difference from just setting state to some object with "isError" or whatever keys, but the thing is - with this "railway oriented programming" you can have large or async pipelines that "exit early" via combinations of map/chain and Either/Maybe. So for example you can have a Fluture that you fold() into an Either - or even a whole series of them, and if at any point in that mechanism you get an error or stop the loading, it will literally use the same exact code as this tiny demo, in terms of updating the view accordingly :)

dakom avatar Jul 17 '18 11:07 dakom

How do you feel Sanctuary could improve Context + Resolvers in an Apollo Server GraphQL for RedisGraph? I'm super keen to get into graph data with this stack and want to do this... but this library is so jargon-heavy I'm concerned it's gonna slow me down rather than help, and that it would scare off other implementers

bionicles avatar Nov 25 '19 14:11 bionicles

How do you feel Sanctuary could improve Context + Resolvers in an Apollo Server GraphQL for RedisGraph?

I know very little about these things, @bionicles. Perhaps someone else will be more helpful. :crossed_fingers:

davidchambers avatar Nov 25 '19 14:11 davidchambers