3 ms·
> Types that can actually restrict values Do you mean run-time checks? If yes then all you need is a normal oop class with an `assert` in your constructor. If
by andrepd 5y ago
> Types that can actually restrict values
Do you mean run-time checks? If yes then all you need is a normal oop class with an `assert` in your constructor. If you mean compile-time checks then that's a much much harder problem.
> Enumerated errors
If you have sum types/enums then enumerated errors are just a normal enum. Like
type err = FileDoesntExist | PermissionError | NoDiskSpace
type result = Ok file | Err err
- Jeff_Brown 5y agoI believe he means compile-time checks. Th formal term for this is dependent types. Some languages offer it. Haskell is working on making it ergonomic. It's already quite ergonomic in Idris.