On Mar 18, 2015, at 5:20 PM, Benjamin Greenman wrote:
> Switching to cons was an easy fix.
Not a fix. You get different errors at different times. Don't think "it works";
think "does it work for errors, too?"
Racket Users list:
http://lists.racket-lang.org/users
If you want the continuation-passing-style version, you'll need to
explicitly handle the multiple-ness of multiple values:
#lang typed/racket
(: my-force (All (A ...) (-> (-> (Values A ...)) (Values A ...
(define (my-force x) (x))
(ann (my-force (lambda () (values (void) (void (Values Vo
On Wed, Mar 18, 2015 at 5:16 PM, Michael Wilber wrote:
> this doesn't work in vanilla Racket
>
Sure, but it works without the let! For context, I ran into this issue
adding types to a function originally written in continuation passing
style. Switching to cons was an easy fix.
__
On Wed, Mar 18, 2015 at 5:11 PM Alexis King wrote:
> It might be a good idea to have a special case for Values when producing
> error messages. Currently, even though the documentation mentions that
> Values is only valid as the return type of a function, the error messages
> can be a little conf
To expand a little bit on Sam's answer, this doesn't work in vanilla
Racket either.
> (define (my-apply f) (let ([tmp (f)]) f))
> (my-apply (lambda () (values 1 2)))
result arity mismatch;
expected number of values not received
expected: 1
received: 2
values...:
It might be a good idea to have a special case for Values when producing error
messages. Currently, even though the documentation mentions that Values is only
valid as the return type of a function, the error messages can be a little
confusing. For example, using Values as an expression produces
Type variables range only over types, and `(Values A B)` isn't a type.
If your program type checked, then the following program would too:
(: my-force : (All (A) (-> A) -> A))
(define (my-force f)
(let ([tmp : A (f)]) tmp))
(my-force (lambda () (values (void) (void)))
but this program has a ru
Today I got a surprising type error that I think is worth sharing.
(: my-force (All (A) (-> (-> A) A))
(define (my-force x) (x))
(my-force (lambda () (values (void) (void)))
;; ERROR! 'my-force' cannot be applied to argument.
;; expected "(-> A)", got "(-> (values Void Void))"
;; result type "A",
8 matches
Mail list logo