Re: [racket-users] Typed Racket: Subtype of a struct typed where one field has a fixed value

2021-01-16 Thread je...@lisp.sh
I have it on good authority that parametric types are the way to go. Look at this: #lang typed/racket (struct (α β) point ([x : α] [y : β])) (define-type Point point) (define-type FixedY (Point Real 0)) That's it! On Saturday, January 16, 2021 at 6:26:17 PM UTC+1 sorawe...@gmail.com

Re: [racket-users] Typed Racket: Subtype of a struct typed where one field has a fixed value

2021-01-16 Thread Sorawee Porncharoenwase
According to https://docs.racket-lang.org/ts-reference/type-ref.html, `Zero` exists. On Sat, Jan 16, 2021 at 8:14 AM je...@lisp.sh wrote: > Working in Typed Racket, consider a struct like this: > > (struct point > ([x : Real] >[y : Real])) > > Is there a way to express the type of those

[racket-users] Typed Racket: Subtype of a struct typed where one field has a fixed value

2021-01-16 Thread je...@lisp.sh
Working in Typed Racket, consider a struct like this: (struct point ([x : Real] [y : Real])) Is there a way to express the type of those points whose y field is, say, 0? In other words, I'd like a talk about point structs where x varies freely, but y is always 0. Obviously, I can make a