Re:Types as axioms, or: playing god with static types
by valenterry on Saturday August 15, 2020 @11:27PM
(#24174733)
> is that the TypeScript values "X" and "Y" already exist (they're strings)
Thank you, that makes sense. My impression was that typescript was chosen as an arbitrary language and that this limitation would be irrelevant for the example, but maybe it was chosen specifically.
I'm mainly a Scala developer, and in Scala 3 we can pretty much do:
case object A
case object B
type X = A | B
or
type X = "A" | "B"
Where A and B didn't exist before, but "A" and "B" do. Does that capture the difference that the author wants to express?
There is still a difference to Haskell though, in that the "case object A" is its own type and a subtype of X.
Thank you, that makes sense. My impression was that typescript was chosen as an arbitrary language and that this limitation would be irrelevant for the example, but maybe it was chosen specifically.
I'm mainly a Scala developer, and in Scala 3 we can pretty much do:
or Where A and B didn't exist before, but "A" and "B" do. Does that capture the difference that the author wants to express?There is still a difference to Haskell though, in that the "case object A" is its own type and a subtype of X.