Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Andrew Kent
Does using andmap with the custom predicates you alluded to for that union you mentioned work? Something like this perhaps?: #lang typed/racket (struct: T1 ()) (struct: T2 ()) (define-type T1or2 (U T1 T2)) (: T1or2? (-> Any Boolean : T1or2)) (define (T1or2? a) (or (T1? a) (T2? a))) (: listo

Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Konrad Hinsen
Andrew Kent writes: > Will andmap work for you? Interesting... I didn't know about that one. For my demonstration code, that's indeed a good solution. In my real application, the test is more complicated. I need to check all elements of a list for conformance to a union type, so I have no prefa

Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Andrew Kent
Will andmap work for you? (struct: foo ()) (struct: bar ()) (define-type FooOrBar (U foo bar)) (: f-bar (-> (Listof bar) Void)) (define (f-bar xs) (void)) (: f-mixed (-> (Listof FooOrBar) Void)) (define (f-mixed xs) (void)) (: f (-> (Listof FooOrBar) Void))