Are there dynamic languages with fully fleshed ADT out there? Mostly curious if Option<Option<T>> is representable. It's not in typescript?
Conversation
`Option<T>` is a tagged union. Would be the equivalent `type Option<T> = { tag = 'some', value: T } | { tag: 'none' }` in Typescript.
1
How how do you express Option<Option<T>> then?
1
as far as I can see it's basically a flat union in TS?
2
`{ tag: 'some', value: { tag: 'some', value: 1 } }`...?
2
oh i guess i see what you mean. Just make a struct?
1
Yep. `type Option<T> = T | nil` doesn't work, because you don't have a tag.
1
But effectively it would mean you can't determine from value without static type info what type it is if it's `None`
2
or nevermind, i guess you can
1

