|
|
|
|
|
by crabbone
1204 days ago
|
|
No. it's not the approach OP recommends. And that's why it's called validation. I have no idea why would you question that. OP wants to capture constraints on data as ML-style types. But, ML-style types have very limited expressive power, and, when it comes to real-life situation are practically useless outside of the most trivial cases. |
|
It absolutely is.
> I have no idea why would you question that.
I did not question [that they were different approaches], I explained, through example and counter-example, why they were the same approach. I will try again.
Alexis wrote both 'validate' and 'parse' examples in ML-style types:
More from the article: I chose OO-style types for my samples, because there's a large fraction of HN users who dismiss ML-ish stuff as academic, or "practically useless outside of the most trivial cases". > But, ML-style types have very limited expressive powerHindley-Milner types are a godddamned crown-jewel of computer science.