type-expander/test
2017-04-27 22:54:34 +02:00
..
base-lang-test-1.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
base-lang-test-2.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
base-lang-test-3.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
lang-test-1.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
lang-test-2.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
lang-test-3.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
readme.rkt Squashed commits. 2017-04-27 22:54:34 +02:00
type-expander-test.rkt Squashed commits. 2017-04-27 22:54:34 +02:00

#lang typed/racket
(require type-expander
         typed/rackunit
         (for-syntax racket/list))

(define-type-expander (Repeat stx)
  (syntax-case stx ()
    [(_ t n)
     #`(List #,@(map (λ (x) #'t)
                     (range (syntax->datum #'n))))]))

(: five-strings (→ String (Repeat String 5)))
(define (five-strings x)
  (list x "a" "b" "c" "d"))

(check-equal? (five-strings "hello")
              '("hello" "a" "b" "c" "d"))

(check-equal? (ann (five-strings "moon") (Repeat String 5))
              '("moon"  "a" "b" "c" "d"))