Re: [racket-users] srcloc->string exported by tr/base but without type?

2016-06-28 Thread Sam Tobin-Hochstadt
No, this is just an oversight, presumably.

You could contribute this improvement to other Typed Racket users by making
a change to `typed-racket/base-env/base-env` (here:
https://github.com/racket/typed-racket/blob/master/typed-racket-lib/typed-racket/base-env/base-env.rkt
).

In general, minor issues with TR are probably best handled as Issues on the
GitHub repo.

Sam

On Tue, Jun 28, 2016 at 5:49 PM 'John Clements' via Racket Users <
racket-users@googlegroups.com> wrote:

> This just seems like an oversight… the program
>
> #lang typed/racket/base
>
> srcloc?
>
> srcloc->string
>
> … fails to type-check because typed/racket/base doesn’t include a type for
> srcloc->string. Based on the documentation, it looks like I can use the
> type (srcloc -> (U String False)) for this type, and I can certainly add
> this myself, like this:
>
> (require/typed typed/racket/base
>[srcloc->string (srcloc -> (U String False))])
>
> Is there some reason this isn’t already built in?
>
> John
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] srcloc->string exported by tr/base but without type?

2016-06-28 Thread 'John Clements' via Racket Users
This just seems like an oversight… the program

#lang typed/racket/base

srcloc?

srcloc->string

… fails to type-check because typed/racket/base doesn’t include a type for 
srcloc->string. Based on the documentation, it looks like I can use the type 
(srcloc -> (U String False)) for this type, and I can certainly add this 
myself, like this:

(require/typed typed/racket/base
   [srcloc->string (srcloc -> (U String False))])

Is there some reason this isn’t already built in?

John


-- 
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.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


[racket-users] Reminder: (sixth RacketCon) Call for Speakers

2016-06-28 Thread Vincent St-Amour
Racketeers,

The (sixth RacketCon) program is starting to take shape! Check out our
web page[1] for a sneak peek.

We still have a couple of speakers slots open, but not many. If you're
interested in speaking about a Racket-related project of yours, please
let me know!

Also, if you haven't registered yet, please do at:
https://www.eventbrite.com/e/racketcon-2016-tickets-24349152972

(sixth RacketCon) will be held on September 18th in St. Louis.
We are pleased to once more be co-located with Strange Loop[2].

RacketCon is a yearly event where members of the Racket community get
together, featuring talks and demos about the things you do with Racket.

See you in St. Louis!

Vincent, for the Racket team


[1] http://con.racket-lang.org/
[2] https://thestrangeloop.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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] [racket][typed] infinite typechecking

2016-06-28 Thread WarGrey Gyoudmon Ju
Hello,

This is version 6.5.0.5.

(define-syntax (define-tokens stx)
  (syntax-case stx []
[(_ token
#:+ Token (extra ...)
#:with [[subtoken #:+ SubToken subrest ...] ...]
[id #:+ ID #:-> parent #:as Type rest ...] ...)
 (with-syntax ([token->datum (format-id #'token "~a->datum" (syntax-e
#'token))]
   [([id? id-datum] ...) (for/list ([ (in-list
(syntax->list #'(id ...)))])
   (list (format-id  "~a?"
(syntax-e ))
 (format-id  "~a-datum"
(syntax-e ])
   #'(begin (struct: token : Token ([source : Any] [line : Natural]
[column : Natural]
   [position : Natural]
[span : Natural] extra ...))
(struct: subtoken : SubToken subrest ...) ...
(define-token id #:+ ID #:-> parent #:as Type rest ...) ...

(define token->datum : (-> Token Datum)
  (lambda [instance]
(cond [(id? instance) (id-datum instance)] ...
  [else (assert (object-name instance)
symbol?)])]))

The following code is okay, however, if more definitions are added, then
the typechecking will refuse to terminate itself.

(define-tokens css-token
  #:+ CSS-Token ()
  #:with [[css:numeric #:+ CSS:Numeric css-token ([representation :
String])]
  [css:number #:+ CSS:Number css:numeric ()]]
  [css:bad  #:+ CSS:Bad #:-> css-token #:as Datum]
  [css:close #:+ CSS:Close #:-> css-token #:as Char]
  [css:cd #:+ CSS:CD #:-> css-token #:as Symbol]
  [css:match #:+ CSS:Match #:-> css-token #:as Char]
  [css:ident #:+ CSS:Ident #:-> css-token #:as Symbol]
  [css:url #:+ CSS:URL #:-> css-token #:as String]
  [css:function #:+ CSS:Function #:-> css-token #:as Symbol])

The attachment contains the full example to run.
Thanks.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


infinite-typechecking.rkt
Description: Binary data