|
|
|
|
|
by colllectorof
2422 days ago
|
|
A properly enforced static type would not need to emit Maybe, because it would be impossible to set it to the wrong value in the first place. Not to mention that to be truly useful a static type would need some sort of literal that would emit a compile-time error if the supplied init data was wrong. In short, examples above do not demonstrate Haskell's ability to statically enforce rules like "string needs to end with a dot". Now, you could make a type that always prepends a dot when asked for a string representation, which happens to enforce this specific constraint, but you cannot use a trick like this for most constraints (such as the second example of "only alpha characters"). |
|