Constraints for text unboxed type
@regexp-constraint("[a-zA-Z]+")
unboxed alpha (text);
As https://github.com/nirum-lang/nirum/issues/206 suggested, it might be useful if text is validated by the regular expression that gives in an annotation.
Alpha('1234') # error
Alpha("abcABC') # it works
@dahlia @Kroisse Have you had any suggestions?
If we use regular expressions we should choose a standard (e.g., POSIX Extended Regular Expression) for it to guarantee compatibility between target languages.
POSIX Extended Regular Expression sounds good to me. Should we validate regular expression in an annotation when .nrm file is compiled?
I think that we can use regex module which supports POSIX regular expression.
Should we validate regular expression in an annotation when .nrm file is compiled?
If we want we can do by trying to parse a pattern using Text.Regex.TDFA.ReadRegex.parseRegex function.
Decide to use re2 on Python.