Add a case-> type-constructor as a synonym for case-lambda.

original commit: 1b3052748e3278deefabf646f4990dc1f8064202
This commit is contained in:
Vincent St-Amour 2011-01-24 10:54:26 -05:00
parent 2b933e4436
commit f8b7eb8073
4 changed files with 6 additions and 4 deletions

View File

@ -98,6 +98,8 @@
(-polydots (a) (t:-> (make-ValuesDots (list) a 'a)))]
[(case-lambda (Number -> Boolean) (Number Number -> Number)) (cl-> [(N) B]
[(N N) N])]
[(case-> (Number -> Boolean) (Number Number -> Number)) (cl-> [(N) B]
[(N N) N])]
[1 (-val 1)]
[#t (-val #t)]
[#f (-val #f)]

View File

@ -12,7 +12,7 @@
;; special type names that are not bound to particular types
(define-other-types
-> U Rec All Opaque Vector
-> case-> U Rec All Opaque Vector
Parameterof List List* Class Values Instance Refinement
pred)

View File

@ -152,7 +152,7 @@
(parameterize ([current-orig-stx stx])
(syntax-parse
stx
#:literals (t:Class t:Refinement t:Instance t:List t:List* cons t:pred t:-> : case-lambda
#:literals (t:Class t:Refinement t:Instance t:List t:List* cons t:pred t:-> : case-lambda t:case->
t:Rec t:U t:All t:Opaque t:Parameter t:Vector quote)
[t
#:declare t (3d Type?)
@ -202,7 +202,7 @@
[((~and kw t:pred) t)
(add-type-name-reference #'kw)
(make-pred-ty (parse-type #'t))]
[((~and kw case-lambda) tys ...)
[((~and kw (~or case-lambda t:case->)) tys ...)
(add-type-name-reference #'kw)
(make-Function
(for/list ([ty (syntax->list #'(tys ...))])

View File

@ -30,7 +30,7 @@ This file defines two sorts of primitives. All of them are provided into any mod
(require "../utils/require-contract.rkt"
"colon.rkt"
"../typecheck/internal-forms.rkt"
(rename-in racket/contract [-> c->])
(rename-in racket/contract [-> c->] [case-> c:case->])
"base-types.rkt"
"base-types-extra.rkt"
racket/flonum ; for for/flvector and for*/flvector