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 [email protected] wrote:

> According to https://docs.racket-lang.org/ts-reference/type-ref.html, 
> `Zero` exists. 
>
> On Sat, Jan 16, 2021 at 8:14 AM [email protected] <[email protected]> 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 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 function that 
>> discriminates this subclass, but I'm not sure how to express it as a type. 
>> I've hunted around in the docs, but I can't quite find what I'm looking for.
>>
>> -- 
>> 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 [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/ee8bc006-590c-48f6-ac8b-4ef4f88019dfn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/racket-users/ee8bc006-590c-48f6-ac8b-4ef4f88019dfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/54f032ae-925e-4b15-abe9-caae53e49b83n%40googlegroups.com.

Reply via email to