natefaubion / purescript-spork

Elm-like for PureScript
MIT License
157 stars 9 forks source link

SPA Example? #22

Open brezal opened 6 years ago

brezal commented 6 years ago

Would you be open to demonstrating what a SPA would look like in spork, e.g.: https://github.com/rtfeldman/elm-spa-example

natefaubion commented 6 years ago

Is there anything in particular you are looking how to translate? The "RealWorld" app is a great example, but it's extremely non-trivial, and I don't have the fortitude to implement it right now 😆.

For example, I think we could have a dedicated example for effects, and replacing usage of ports.

brezal commented 6 years ago

@natefaubion Quick response! Currently, I am interested in routing.

natefaubion commented 6 years ago

The todo example has a naive implementation that shows how you can use the AppInstance to integrate with a routing framework (https://github.com/natefaubion/purescript-spork/blob/master/examples/todo-mvc/src/Main.purs#L443-L446), but I agree a large example writing a purescript-routing parser would be appropriate. For inspiration, there is https://github.com/parsonsmatt/purescript-routing-example/blob/master/src/Router.purs#L22-L43 which is an example for integrating with Halogen.

brezal commented 6 years ago

Thank you. Other examples you can think of and link to would also help, but I understand if you don't have the time for this.

I guess I'm wondering how realistic it is to build on this project and what are the consequences :)

natefaubion commented 6 years ago

I started work on a CRUD example https://github.com/natefaubion/purescript-spork/tree/crud-example/examples/crud. If you'd like to add to it, or make improvements, it would be appreciated.

I guess I'm wondering how realistic it is to build on this project and what are the consequences :)

Spork is a hobby project I maintain so users familiar with TEA can try out PureScript without having to deal with a mess of JS dependencies. It's lightweight and decently performant, with a small enough codebase that anyone can read it in a weekend. I don't maintain a hand-tailored ecosystem for it, so it's designed to be fairly extensible in how it interfaces with the rest of the PS ecosystem. You should be able to do whatever you want without too much fuss in that regard.