I'm writing small pet project in Racket and using Gregor lib to handle dates.
I have function that accepts two dates (from Gregor, not standard library) and I would like to add contract for it. Contract should say that date from first argument has to be less/earlier than date from second argument.
In Gregor we can achieve it by using (date<=? x y) or similar predicate, but I cannot understand how to combine it with contracts.
(contract-out
[process-dates (->i ([x date?]
[y (x) (and/c date?
(date>=? x))])])
will not work, and there is no out-of-box date>=?/c
predicate.
So I guess that I will need to write such predicates by my own, therefore I would like to know how to do it. I've looked through Racket sources and found that standard features are quite complicated to reproduce.
Is there simpler way to achieve what I want?