logoalt Hacker News

shhsshsyesterday at 8:26 PM1 replyview on HN

That is a LOT of code (very ugly code, I would add) that could be replaced by `type Float = float32 | float64` in a language with actual support for union types.


Replies

kccqzyyesterday at 9:26 PM

Tagged unions are not union types. A union type is a supertype for any arbitrary collection of types, but a tagged union aka sum type is a single type with multiple data constructors, and does not require subtyping to be implemented.