2012/3/14 Ray Racine <[email protected]>:
> I could use an assist on getting the following to type check.

The program below works.  I made two changes.

1. You added `All' in the type parameter list for `struct:'.  You
don't need that there, and instead it was adding a third type
parameter to `Cvt'.

2. There's some problem with inference and struct accessors, which
makes the use of `ann' below required.  I've filed that as bug 12631,
and hope to fix it soon.

#lang typed/racket/base

(struct: (T0 T1) Cvt ([cvt : (T0 -> T1)]))

(: cvt-apply (All (T0 T1) (T0 (Cvt T0 T1) -> T1)))
(define (cvt-apply value cvt)
  ((ann (Cvt-cvt cvt) (T0 -> T1)) value))

(: ItoS-Convert (Cvt Integer String))
(define ItoS-Convert
  (Cvt (λ: ((x : Integer)) "Hello")))

(: ItoS (Integer -> String))
(define (ItoS int)
  (cvt-apply int ItoS-Convert))


-- 
sam th
[email protected]

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to