Hi, Is there an idiomatic Typed Racket equivalent to the Haskell concept of newtypes?
https://www.haskell.org/tutorial/moretypes.html That is, some way to have separate types that share a common structure? For example I'd like to define "Radians" and "Degrees" types that are both implemented as Flonums but have Typed Racket raise a type error when a Radians value is used where a Degrees value is expected. I can see using single field structs might work: (struct: Radians ([a : Flonum])) (struct: Degrees ([a : Flonum])) ; type checks (: d-90 : Degrees) (define d-90 (Degrees 90.0)) ; type mismatch! (: r-PI : Radians) (define r-PI (Degrees 180.0)) Is there a better way of working with the Typed Racket idioms to do this kind of thing? Thanks, Stu -- 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.