Elsa
Elsa copied to clipboard
Add extensions for built-in predicates "always returning true" if corresponding argument is passed
So that (stringp "foo") or (integerp 1) are flagged as always true. and (stringp :keyword) as always false.
This can be made much more general with something like "multiple type signatures". I can set signature of stirngp to Mixed -> Bool and then add additional conditional signatures such as
String -> T
Mixed \ String -> Nil
Mixed -> Bool (this is the general one, always last because it's the broadest. It's automatic)
The first to match will determine the "run-time" return type. This way it will be really fast to add type logic to functions and it can apply beyond predicates, for example -list from dash has logic "if list, return list, if atom, return it wrapped in a list", so the type would be:
[a] -> [a]
a -> [a]
Mixed -> List (automatic, but this should never match in practice)