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
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
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
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
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 ...) #
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))
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<)
7 matches
Mail list logo