Hello all!

I have a question regarding how sequence abstraction works in TR. In the 
sequence part of the docs it says that a sequence can consist of lists or 
vectors among other things. But does this make a function which ideally accepts 
a (Listof a) to accept something that is declared as a (Sequenceof a)? For 
example, in TR this works:

(: x (Sequenceof Symbol))
(define x '(a b c d))

However, this shows a type mismatch:

#lang typed/racket

(: step (All (a)
             (-> (-> a (Sequenceof a) (Sequenceof a))
                 (Sequenceof a)
                 (Sequenceof a))))
(define (step fn x seq)
  (fn x seq))

(step (ann cons (-> Symbol (Listof Symbol) (Listof Symbol)))
      '(b c))

Results in:

Type Checker: Polymorphic function `step' could not be applied to arguments:
Argument 1:
  Expected: (-> a (Sequenceof a) (Sequenceof a))
  Given:    (-> Symbol (Listof Symbol) (Listof Symbol))
Argument 2:
  Expected: a
  Given:    'a
Argument 3:
  Expected: (Sequenceof a)
  Given:    (List 'b 'c)

I think, trying to instantiate the polymorphic step function might help but I 
was not able to figure out how.

Thanks in advance.

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to