Re: [racket] typed racket and generic interfaces, is there a workaround using properties?

2014-09-26 Thread Spencer florence
I don’t think you can. You would need define the struct in an untyped module then require it via require/typed. This is why dict’s don’t work in typed/racket either. On Sat, May 24, 2014 at 9:39 PM, Alexander D. Knauth wrote: > Do generic interfaces work using structure type properties, and if

[racket] "do what i mean" for https://github links

2014-09-26 Thread Martin DeMello
It took me a while of reading through the docs to figure out why trying to install a package via "https://github.com/user/pkg"; failed for want of a MANIFEST file. I think the "do what I mean" installer should have autoconverted it to git:// , seeing as how github is already special-cased. (Also m

Re: [racket] typed racket and generic interfaces, is there a workaround using properties?

2014-09-26 Thread Anthony Carrico
Dredging up an old thread: So how exactly do you define custom-write for a typed racket struct? On 05/25/2014 03:30 PM, Alexander D. Knauth wrote: > Never mind I just found prop:dict. > > By the way it would probably be helpful if instead of the value for > prop:dict being a vector, it was a hash

Re: [racket] web server: module servlets

2014-09-26 Thread Jay McCarthy
Hi George, I suggest that all Racket web-server apps not use the dynamic features of serve/servlet either, but instead write the servlet as the single "request -> response" function that serve/servlet provides. This would ensure that all the libraries are loaded the one time and has the best perfo

Re: [racket] ANN: DOS, Delimited-continuation-based Operating-system Simulator

2014-09-26 Thread Jay McCarthy
Sure, I can make a post about it. However, the core idea is already in this post: http://jeapostrophe.github.io/2012-07-12-cont-sys-post.html I can make another one, however, to rehash it and talk about the benefits of monoid states. Jay On Fri, Sep 26, 2014 at 2:15 PM, Michael Bradley, Jr. wr

Re: [racket] typed racket, filters, and polymorphism

2014-09-26 Thread Alexander D. Knauth
Is it possible to have a struct that does certain things according to the guard? #lang typed/racket (struct (a) foo ([a : a]) #:transparent #:guard (lambda (a _) (unless (exact-integer? a) (error 'foo "expected Integer, given ~v" a)) a)) (ann (foo (ann 1 An

Re: [racket] ANN: DOS, Delimited-continuation-based Operating-system Simulator

2014-09-26 Thread Michael Bradley, Jr.
Jay McCarthy writes: > > I've just released the game architecture library I talked about in > part 2 of my RacketCon talk. > > The big picture of this library is to make World-style programs more > compositional by (a) using continuations to hide the internal state > (including control state)

Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Andrew Kent
Does using andmap with the custom predicates you alluded to for that union you mentioned work? Something like this perhaps?: #lang typed/racket (struct: T1 ()) (struct: T2 ()) (define-type T1or2 (U T1 T2)) (: T1or2? (-> Any Boolean : T1or2)) (define (T1or2? a) (or (T1? a) (T2? a))) (: listo

Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Konrad Hinsen
Andrew Kent writes: > Will andmap work for you? Interesting... I didn't know about that one. For my demonstration code, that's indeed a good solution. In my real application, the test is more complicated. I need to check all elements of a list for conformance to a union type, so I have no prefa

Re: [racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Andrew Kent
Will andmap work for you? (struct: foo ()) (struct: bar ()) (define-type FooOrBar (U foo bar)) (: f-bar (-> (Listof bar) Void)) (define (f-bar xs) (void)) (: f-mixed (-> (Listof FooOrBar) Void)) (define (f-mixed xs) (void)) (: f (-> (Listof FooOrBar) Void))

[racket] Tricky case of occurrence typing in Typed Racket

2014-09-26 Thread Konrad Hinsen
Hi everyone, I am trying to convince Typed Racket that after a run-time check on some list, its elements are all of a given type. This is just like occurrence typing based on a predicate, except that my predicate is more complicated. My first attempt was this: #lang typed/racket (struct: