Trade Logic: Missed a type constructor
I forgot one type constructor before, the one to construct the type of predicates. It was covered by "One of the exposed primitive types", but inadequately. It needs to can express a predicate's type parameters.
Rather than mixing applications and literal lists, or requiring list
at the beginning of each list, I will use low-quote and write:
,(pred . Args)
where pred
is the symbol pred
and Args is a type (named or
literal) augmented by mode annotations. This type accepts any
predicate whose inputs are all equally or less strict than the
respective parts of Args and whose outputs are all equally or more
strict than the respective parts of Args. It would also reject
predicates that had no equivalent mode.
For example, the type , (pred type +type)
would accept/reject
various predicates:
Arg1 type | Arg2 type | Disposition |
---|---|---|
type in | type out | Accept |
thing in | type out | Accept |
thing in | thing out | Reject |
thing in | type out | Accept |
thing in | type in | Reject |
type out | type out | Reject |
I may need to do more for the interaction of the mode system and the type system here.
No comments:
Post a Comment