为什么不用关键字arg进行string-normalize-whitespace类型检查?

时间:2014-03-27 23:01:36

标签: types scheme racket typed-racket

在打字球拍中,

我有

  `(: collapse ((Listof Expansion) -> Expansion))
   ; flatten a list of expansions into a single expansion representing the whole thing--
  (define (collapse expansions)
     (letrec: ([token : String   (foldl (λ: ([e : Expansion] [working : String]) (string-append working (token-of e))) "" expansions)]
        [normalized-token  : String (string-normalize-spaces token)]
        [lexicon : Lexicon (foldl (λ: ([e : Expansion] [working : Lexicon])
                                    (merge-lexica working (lexicon-of e))) 
                           (empty-lexicon) 
                           expansions)])
      (make-expansion token lexicon)))`

给了我

Type Checker: Expected String, but got (case-> (String [#:repeat? Any] [#:trim? Any] -> String) (String (U Regexp String) [#:repeat? Any] [#:trim? Any] -> String) (String (U Regexp String) String [#:repeat? Any] [#:trim? Any] -> String)) in: (string-normalize-spaces token #:trim #f)

如果我删除关键字arg,这将检查正常(当然,它实际上并没有实现我想要的)。

升级到最新版本(震惊!)改善了问题 - 解决了我的require问题,但我显然仍然遗漏了一些东西。

1 个答案:

答案 0 :(得分:1)

升级到Racket 6.0并删除了require,消除了错误。