[racket] Typed Racket: Defining a sequence predicate
Hi,
I recently discovered Typed Racket and am having a lot of fun with it.
Occurrence typing is pretty amazing.
I've stumbled across a couple of problems when trying to use
dictionaries and sequences, though. In particular, I'm currently
having trouble defining a predicate for the (Sequenceof Any) type. I
tried importing sequence? with the type that I think it should have:
(require/typed racket
[sequence? (Any -> Boolean : (Sequenceof Any))])
This made Racket complain about not being able to create a contract
out of the type specification:
Type Checker: Type (Any -> Boolean : (Sequenceof Any)) could not
be converted to a contract. in: (Any -> Boolean : (Sequenceof Any))
In addition, define-predicate seems to do something weird (type-incorrect even):
> (define-predicate anyseq? (Sequenceof Any))
> anyseq?
- : (Any -> Boolean : (Sequenceof Any))
#<make-contract>
> (anyseq? 100)
procedure application: expected procedure, given:
#<make-contract>; arguments were: 100
Is this a bug, or am I misusing define-predicate?
I'm using Racket 5.1.2 on Mac OS X.
Thanks!
Matthias