www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

pure-exception.rkt (936B)


      1 #lang typed/racket
      2 
      3 (provide unsafe-pure-block/stateless
      4          unsafe-operation-block/mutating
      5          unsafe-pure/stateless
      6          unsafe-operation/mutating)
      7 
      8 (module m typed/racket
      9   (provide unsafe-pure-block/stateless
     10            unsafe-operation-block/mutating)
     11   (define-syntax-rule (unsafe-pure-block/stateless . body)
     12     (λ () . body))
     13   (define-syntax-rule (unsafe-operation-block/mutating . body)
     14     (λ () . body)))
     15 
     16 (require 'm)
     17 
     18 (define-syntax (unsafe-pure/stateless stx)
     19   (syntax-case stx ()
     20     [(_ . body)
     21      (with-syntax ([lifted-id (syntax-local-lift-expression
     22                                #'(unsafe-pure-block/stateless . body))])
     23        #'(lifted-id))]))
     24 
     25 (define-syntax (unsafe-operation/mutating stx)
     26   (syntax-case stx ()
     27     [(_ . body)
     28      (with-syntax ([lifted-id (syntax-local-lift-expression
     29                                #'(unsafe-operation-block/mutating . body))])
     30        #'(lifted-id))]))