This might be too minimal of an example.
It looks like typed Racket doesn't want you to use Typed Racket types in certain
contexts.
To implement the functionality I think you want from that example, I would
write the following

#lang turnstile

(require (only-in (prefix-in tr: typed/racket)
                  tr::print-type
                  tr:ann
                  tr:#%module-begin
                  tr:Number
                  tr:#%datum)
         turnstile/no-unicode)
(provide #%datum (rename-out (tr:#%module-begin #%module-begin)))

;[DATUM]
(define-typed-syntax #%datum
  [(_ . n:number) >>
   -------------------
   [≻ (tr:ann (tr:#%datum . n) tr:Number)]])


You probably need to use a Turnstile types in your language, and generate Typed
Racket types using the `ann` form from Typed Racket.

--
William J. Bowman

On Tue, Oct 29, 2019 at 10:07:21AM -0700, Raoul Schorer wrote:
> Hi,
> 
> I am attempting to expand to typed/racket from a custom language through 
> #lang turnstile. Unfortunately, the macro stepper isn't helping me much as 
> to how I should do that.
> So far, this minimal example:
> 
> #lang turnstile
> 
> (require (only-in (prefix-in tr: typed/racket)
>                   tr:#%module-begin
>                   tr:Number
>                   tr:#%datum)
>          turnstile/no-unicode)
> (provide #%datum #%module-begin)
> 
> ;[MODULE-BEGIN]
> (define-syntax (#%module-begin stx)
>   (syntax-parse stx
>     [(_ prg) #`(tr:#%module-begin prg)]))
> 
> ;[DATUM]
> (define-typed-syntax #%datum
>   [(_ . n:number) >>
>    -------------------
>    [/- (tr:#%datum . n) => tr:Number]])
> 
> returns an error when I try to type a number in the REPL:
> > 1
>   type-check: type name used out of context
>   type: tr:Number
>   in: tr:Number in: tr:Number
> 
> I am a bit lost. Could someone give me pointers on how to expand to 
> typed/racket types using turnstile, please?
> 
> Thanks a lot!
> Raoul
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/b9b56563-3a18-406d-9f2f-935220673b79%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20191029173336.GJ2191%40williamjbowman.com.

Reply via email to