-
Notifications
You must be signed in to change notification settings - Fork 4
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
Finish SignUp
example
#2
Comments
@thomashoneyman I've added sign up form to test suite which is tested against Http data source: https://github.com/paluh/purescript-polyform/blob/master/test/Polyform/Input/Http.purs#L116 I'm going to move this example to docs this weekend. |
And here is relevant test: https://github.com/paluh/purescript-polyform/blob/master/test/Polyform/Input/Http.purs#L186 |
Thanks @paluh! I've been working on a minimal formlets implementation for Halogen, but if Polyform is able to work well with Halogen, I'd love to contribute to the library. I'll pull it down this weekend and see how far I get. Have you tried this yet? |
Unfortunately I'm testing this library on the backend currently (hence But... I want to write simple implementation of #1 so probably I will provide some stub for |
@thomashoneyman This signup form is also quite nice candidate to check if this is feasible with this library #4 because we have "local" passwords and inputs checks and "remote" email check ;-) |
Right -- being able to mix monadic / applicative is vital. For us, flexible rendering matters a lot as well, and so the Halogen HTML base is critical.
Noted! |
I can provide wrapper around Here we have applicative validation in action: passwordFormA = { password1: _, password2: _ } <$> password1Form <*> password2Form It appends This monadic version (here passwordFormM = do
password1 <- password1Form
password2 <- password2Form
if password1 != password2
then formError "Passwords don't match"
else pure { email, password } It won't append the second "form" from This library solves this problem by providing passwordFormA >>> (Validation $ \{ password1, password2 } ->
pure $ if password1 != password2
-- I don't now here exact structure of your possible form so I'm using hypothetical heper
then Invalid (errorForm "Passwords don't match")
else Valid mempty password1 |
what would be great is mixing the two with https://pursuit.purescript.org/packages/purescript-parallel/3.2.0/docs/Control.Parallel#t:Parallel: liftPar2 f a b = sequential $ lift2 f (parallel a) (parallel b)
passwordFormM = do
{ password1, password2 } <- liftPar2 { password1: _, password2: _ } password1Form password2Form
if password1 != password2
then formError "Passwords don't match"
else pure password1 |
@MonoidMusician This is really cool idea. I'm going to look into that and try to provide appropriate instances! |
I'm still not sure if I should provide https://github.com/paluh/purescript-polyform/blob/master/src/Polyform/Form/Validation/Par.purs |
I'm closing this in favour of #5 |
No description provided.
The text was updated successfully, but these errors were encountered: