Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bidirectional route parsing #120

Open
bigs opened this issue May 19, 2017 · 6 comments
Open

bidirectional route parsing #120

bigs opened this issue May 19, 2017 · 6 comments

Comments

@bigs
Copy link

bigs commented May 19, 2017

hey!

been looking into using pux for a project with a client and am generally feeling good about it! i was wondering if you'd be interested in me putting together a PR implementing bidirectional parsing for the routing layer, i.e. extending the api to create parser/generators that can be interpreted to parse a string into an ADT or, using the same construction, render an ADT into a string representing the route.

this should eliminate the need for functions like this one in the todomvc demo and would give me a nice opportunity to get more intimate with pux.

cool project!
cole

@alexmingoia
Copy link
Owner

alexmingoia commented May 20, 2017

Yeah that'd be great to have.

  1. Does it need to be part of Pux, and can the router be separated as another library? Data.Route or something. I think what's in Pux now could probably live as another module.
  2. There's a lot of ways to serialize and parse routes. Maybe you could provide a pseudo-code example of what you're thinking?

@bigs
Copy link
Author

bigs commented May 20, 2017

ah, good thoughts. i think an external lib would be fine :) i've tinkered with plenty of haskell impls in the past, so i'll take a peek at those, reflect on purescript's differences (this weekend?) and update the issue here.

@paluh
Copy link

paluh commented May 20, 2017

@bigs You can check my port of boomerang library. Recently I've added API based on new generics:

https://github.com/paluh/purescript-boomerang/blob/master/src/Text/Boomerang/Generic.purs

here is a simple usage example:

https://github.com/paluh/purescript-boomerang/blob/master/test/Text/Boomerang/String.purs#L66

Additionally there is a project which is based on old generics and generates bidirectional routes fully automatically. I want to extend its API and add Options to routes builders. I think about something similar to Options from purescript-argonaut-generic-codecs:

https://github.com/paluh/purescript-routing-bob

I have also purescript-puxing-bob which was an experimentation field for best integration of these libraries into old pux. You should igore it, because now when smodler is used and we have proper monad instance I think that it should be easier to add state layer with router to rendering flow (I don't have time to experiment on this now).

Unfortunately both libraries are not ported to purescript-0.11 yet. Let me know what do you think. I'm really open to propositions and discussion.

@bigs
Copy link
Author

bigs commented May 20, 2017

@paluh lovely! going to dig into these this afternoon. not finding a ton of resources on it and i'm fairly new to PS (tho quite experienced w/ haskell & ML)—what are the breaking changes in 0.11?

@bigs
Copy link
Author

bigs commented Jul 12, 2017

an update—things picked up quite a bit with the client so i'm only now getting to frontend work. this is still something i'm interesting in pursuing! i think it will probably rely on generics. i'll keep you posted if i make any forward progress.

@bigs
Copy link
Author

bigs commented Aug 17, 2017

bumping this! i've since embarked on a rather extensive project and found that Data.Codec is a perfect fit for this. my approach will probably be extending purescript-routing to accept codecs. i'm personally using halogen on my project but it should benefit pux as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants