-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix readme #12
Fix readme #12
Conversation
I'll update the PR to include the expandable blocks with full types and validation functions as we've discussed in Slack. Some examples below. First example: type Errors = Array ValidationError
newtype Form f = Form
{ name :: f Errors String String
, password1 :: f Errors String Encrypted
, password2 :: f Errors String Encrypted
}
derive instance newtypeForm :: Newtype (Form f) _ Expand to see the definition of
|
Ready for review (I'll squash the commits at the end) |
readme.md
Outdated
unwrapOutputs' = F.unwrapOutputs | ||
-- `unwrapOutput` is a helper function that will unwrap all these newtypes on your behalf. | ||
-- Used on our custom Form type, it'd apply this transformation: | ||
unwrapOutput' :: Form F.OutputField -> FormOutput |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormOutput
isn't actually a type that's been defined in this README. I think I'd like to keep it as the record, no type alias, to make it clear that the output is just the fields with their output values at the end, nothing fancier than that. What do you think?
readme.md
Outdated
``` | ||
|
||
</details> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding an extra newline here? Looks a bit squashed in the markdown viewer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up, @vyorkin! I have a couple comments in here, but otherwise this should be good to merge.
I noticed this is under the @vyorkin-forks account. Do you want to open a different PR under your @vyorkin account so that handle is listed as a contributor to the repo instead? Up to you.
ah, I think its ok, I hope I'll be able to make more valuable contributions in the future :) |
* Fix typos * Add missing types and functions
Squashed commits, I think its ready |
Thanks! |
First, I want to say thank you for this awesome package 👍
What does this pull request do?
I've just tried to follow the "overview" section and noticed a couple of inconsistencies: a couple of copy/paste typos and a few missing types. It may be a bit hard to follow without knowing the exact types of
ValidationError
,Encrypted
etc, so I've added them. Also, I've addedvalidateNonEmpty
andvalidateMinLength
functions, so now it should be kinda self-contained and easier to follow.Other Notes:
Maybe it makes sense to include the code from the Overview in examples? Here is a gist: https://gist.github.com/vyorkin/9dabae99114a5604717f986be36ff31b
Another thing that might be confusing for newcomers like me is the
identity
-trick, I meanvalidator = applyOnInputFields (identity { name: V.nonEmpty, ... })