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

Validators #3

Open
expede opened this issue Jan 4, 2016 · 3 comments
Open

Validators #3

expede opened this issue Jan 4, 2016 · 3 comments

Comments

@expede
Copy link
Member

expede commented Jan 4, 2016

Add the ability to validate entire ADTs, similar to Ecto models. Validation of individual fields should be left to #2. This feature is meant to enforce structure among fields.

defdata AcuteTriangle, validate: acute do
  angle1: float
  angle2: float
end

defp acute(%AcuteTriangle{angle1: angle1, angle2: angle2}) do: abs(angle1 - angle2) < 90.0
@hariroshan
Copy link

where does the macro defadt exist. I tried import Algae and Use Witchcraft as well. No luck

@expede
Copy link
Member Author

expede commented Nov 22, 2018

Hey @hariroshan 👋

This Issue is from the earliest days of the project, and defadt has since been renamed to defdata, and the syntax changed quite a lot as well. I'll update the text to reflect this. Thanks for pointing it out :)

@toraritte
Copy link
Contributor

toraritte commented Mar 5, 2019

Commented about this in #2. See comment.

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