File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed
hackett-lib/hackett/private
tests/hackett/integration Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 392
392
#:with id- (generate-temporary #'id )
393
393
#:with t_reduced (if (attribute exact?) #'t.expansion (type-reduce-context #'t.expansion ))
394
394
#`(begin-
395
- (define- id- (:/use #,((attribute t.scoped-binding-introducer) #'e ) t_reduced #:exact ))
396
395
#,(indirect-infix-definition
397
396
#'(define-syntax- id (make-typed-var-transformer #'id- (quote-syntax t_reduced)))
398
- (attribute fixity.fixity)))]
397
+ (attribute fixity.fixity))
398
+ (define- id- (:/use #,((attribute t.scoped-binding-introducer) #'e ) t_reduced #:exact )))]
399
399
[(_ id:id
400
400
{~optional fixity:fixity-annotation}
401
401
e:expr)
404
404
#:do [(match-define-values [(list id-) e-] (τ⇐/λ! #'e #'t_e (list (cons #'id #'t_e ))))]
405
405
#:with t_gen (type-reduce-context (generalize (apply-current-subst #'t_e )))
406
406
#`(begin-
407
- (define- #,id- #,e-)
408
407
#,(indirect-infix-definition
409
- #`(define-syntax- id
410
- (make-typed-var-transformer ( quote-syntax #,id-) ( quote-syntax t_gen) ))
411
- (attribute fixity.fixity) ))])
408
+ #`(define-syntax- id (make-typed-var-transformer ( quote-syntax #,id-) ( quote-syntax t_gen)))
409
+ (attribute fixity.fixity ))
410
+ (define- #,id- #,e- ))])
412
411
413
412
(begin-for-syntax
414
413
(struct todo-item (full summary) #:prefab ))
Original file line number Diff line number Diff line change 5
5
(define deps
6
6
'("base "
7
7
"hackett-lib "
8
+ "rackunit-lib "
9
+ "sandbox-lib "
8
10
"testing-util-lib " ))
9
11
(define build-deps
10
12
'() )
Original file line number Diff line number Diff line change
1
+ #lang racket/base
2
+
3
+ ; Ensure recursive definitions work at the top level.
4
+
5
+ (require racket/sandbox
6
+ rackunit
7
+ syntax/strip-context)
8
+
9
+ (define hackett-evaluator (make-evaluator 'hackett ))
10
+ (define (hackett-eval stx) (hackett-evaluator (strip-context stx)))
11
+
12
+ (hackett-eval #'(require hackett))
13
+ (hackett-eval #'(defn fac : {Integer -> Integer}
14
+ [[0 ] 1 ]
15
+ [[x] {x * (fac {x - 1 })}]))
16
+
17
+ (check-equal? (hackett-eval #'(fac 6 )) (hackett-eval #'720 ))
You can’t perform that action at this time.
0 commit comments