Re: [racket] Polymorphic types and curried functions

2014-11-13 Thread Matthias Felleisen
On Nov 13, 2014, at 6:36 PM, Jack Firth wrote: > Thank you :) I think the existence of a statically typed language with such > heavy support for macros means there's a lot of interesting new directions to > experiment in. You could probably build half the syntactic features of > Haskell on top

Re: [racket] Polymorphic types and curried functions

2014-11-13 Thread Jack Firth
Thank you :) I think the existence of a statically typed language with such heavy support for macros means there's a lot of interesting new directions to experiment in. You could probably build half the syntactic features of Haskell on top of Typed Racket with surprisingly little effort. On Thu, N

Re: [racket] Polymorphic types and curried functions

2014-11-13 Thread Jack Firth
That was my general approach, however I had to do a bit more analysis. That macro expands (:/c f (A B) (-> B (-> A B)) to (: f (All (A) (-> B (All (B) (-> A B). I’ve come up with something that checks the argument types in a basic function contract and only provides the polymorphic variables th

Re: [racket] Polymorphic types and curried functions

2014-11-13 Thread Sam Tobin-Hochstadt
That's really cool. Sam On Thu, Nov 13, 2014 at 6:28 PM, Jack Firth wrote: > That was my general approach, however I had to do a bit more analysis. That > macro expands (:/c f (A B) (-> B (-> A B)) to (: f (All (A) (-> B (All (B) > (-> A B). I’ve come up with something that checks the argume

Re: [racket] Polymorphic types and curried functions

2014-11-12 Thread Matthias Felleisen
Sorry that was a superfluous (premature) require: #lang typed/racket ;; syntax ;; (:/c f (α β γ) (-> A B (-> C (-> D E ;; ==> ;; (: f (All (α) (-> A B (All (β) (-> C (All (γ) (-> D E))) (define-syntax (:/c stx) (syntax-case stx (All/c) [(_ f (A ...) τ) (let ([σ (All/c #'(A ...) #

Re: [racket] Polymorphic types and curried functions

2014-11-12 Thread Matthias Felleisen
You cannot write macros that expand within types (yet). But you can write macros for : like this: #lang typed/racket (require (for-template (only-in typed/racket All ->))) ;; syntax ;; (:/c f (α β γ) (-> A B (-> C (-> D E ;; ==> ;; (: f (All (α) (-> A B (All (β) (-> C (All (γ) (-> D E))

[racket] Polymorphic types and curried functions

2014-11-12 Thread Jack Firth
I've been mucking around with Typed Racket some and was writing a polymorphic curried function when something I found counter-intuitive popped up. I had this function: (: compare-projection (All (A B) (-> (-> A A Boolean) (-> (-> B A) (-> B B Boolean) (define (((compare-projection a<)