Re: [racket] Typed Racket - Parameterized Structures Part Duex
Thanks for the assist. All working now. Finished the transcription over lunch. https://gist.github.com/f346804447dc8e19d3d9 On Fri, Mar 16, 2012 at 6:15 AM, Ray Racine wrote: > Thanks for the previous TR assist. > I tried manually annotating stuff inside the 'get' procedure below but > can't seem to get it to type check. > Thanks again in advance. > ... Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Typed Racket - Parameterized Structures
On Wed, Mar 14, 2012 at 10:56 AM, Matthias Felleisen wrote: > > Typed Racket isn't Racket. It's supposed to introduce some sanity. I want programming in Typed Racket to be a Racket-like experience, more than I want Typed Racket to conform to some other set of aesthetic preferences (even mine). > Is (All (All) (All -> All)) a type? No, that doesn't parse, so there's clearly an inconsistency here. I will have to think about the best way to resolve it. > On Mar 14, 2012, at 10:55 AM, Sam Tobin-Hochstadt wrote: > >> On Wed, Mar 14, 2012 at 10:27 AM, Matthias Felleisen >> wrote: >>> >>> On Mar 14, 2012, at 8:28 AM, Sam Tobin-Hochstadt wrote: >>> 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'. >>> >>> Perhaps All shouldn't be allowed there. >> >> I thought of that as well, but we don't normally restrict binding >> names in Racket. For example, this is a perfectly good replacement >> for `list': >> >> (lambda lambda lambda) >> >> :) >> -- >> sam th >> [email protected] > -- sam th [email protected] Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Typed Racket - Parameterized Structures
On Wed, Mar 14, 2012 at 10:27 AM, Matthias Felleisen wrote: > > On Mar 14, 2012, at 8:28 AM, Sam Tobin-Hochstadt wrote: > >> 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'. > > Perhaps All shouldn't be allowed there. I thought of that as well, but we don't normally restrict binding names in Racket. For example, this is a perfectly good replacement for `list': (lambda lambda lambda) :) -- sam th [email protected] Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Typed Racket - Parameterized Structures
Typed Racket isn't Racket. It's supposed to introduce some sanity. Is (All (All) (All -> All)) a type? On Mar 14, 2012, at 10:55 AM, Sam Tobin-Hochstadt wrote: > On Wed, Mar 14, 2012 at 10:27 AM, Matthias Felleisen > wrote: >> >> On Mar 14, 2012, at 8:28 AM, Sam Tobin-Hochstadt wrote: >> >>> 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'. >> >> Perhaps All shouldn't be allowed there. > > I thought of that as well, but we don't normally restrict binding > names in Racket. For example, this is a perfectly good replacement > for `list': > > (lambda lambda lambda) > > :) > -- > sam th > [email protected] Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Typed Racket - Parameterized Structures
On Mar 14, 2012, at 8:28 AM, Sam Tobin-Hochstadt wrote: > 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'. Perhaps All shouldn't be allowed there. Racket Users list: http://lists.racket-lang.org/users
Re: [racket] Typed Racket - Parameterized Structures
2012/3/14 Ray Racine : > 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

