View Problem Report: 12945
Audit Trail:
State changed from "open" to "closed" by endobson at Wed, 27 Feb 2013 11:17:08 -0500
Reason>>> Not a bug.
From: Eric Dobson <eric.n.dobson at gmail.com>
To: samth at racket-lang.org, ray.racine at gmail.com, stamourv at racket-lang.org,
bugs at racket-lang.org
Cc:
Subject: Re: typed-scheme/12945: Specific Example Of A Combinator Of Two Poly
Functions Failing To Type Check
Date: Wed, 27 Feb 2013 08:16:37 -0800
The reason that this fails to typecheck is that it shouldn't, you need
to rewrite
;;(: drop1keep1Poly (All (D A B) (-> (Iteratee D B))))
;;(define (drop1keep1Poly)
;; (seq (drop 1) (λ: ((accum : A)) (head))))
(: drop1keep1Poly (All (D) (-> (Iteratee D (Option D)))))
(define (drop1keep1Poly)
(seq ((inst drop D) 1) (λ (x) ((inst head D)))))
The reason is that head returns (Iteratee X (Option X)) which doesn't
match (Iteratee D B), and you need the lambda to accept the Void
argument from seq, and annotating it as A, prevents that. Also the
instantiations are needed because TR's inference is bad at polymorphic
functions applied to polymorphic functions.