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

Export and document $.validate #219

Open
dakom opened this issue Nov 8, 2018 · 2 comments
Open

Export and document $.validate #219

dakom opened this issue Nov 8, 2018 · 2 comments

Comments

@dakom
Copy link

dakom commented Nov 8, 2018

Type.validate is a useful tool for both getting type validation as an Either, and getting more detailed info about where an error occured

Would be great to have it documented on the public Readme(s) - and to have it exported as a function on sanctuary-def via $.validate() :)

I'd imagine the signature would be something like:

validate :: Type -> a -> Either ErrorMessage a

Not sure what ErrorMessage is though

@dakom dakom changed the title Document $.validate Export and document $.validate Nov 8, 2018
@janwirth
Copy link

janwirth commented Mar 18, 2021

New api proposal

const pi = def('myVar')([])($.IntegerType)(3.14)

@davidchambers
Copy link
Member

Both the pure function suggested by @dakom and the assertion suggested by @FranzSkuffka are good ideas! I would like to provide both, as they have different use cases.

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

No branches or pull requests

3 participants