Hacker News new | past | comments | ask | show | jobs | submit login

Sum types! I don't get to use that kind of stuff very much, so I tend not to think about them off the top of my head :)

How do languages with sum types handle scenarios where the type is A+B, but B is a subtype of A? So you're really guaranteed to have an A, but you may or may not have a B? Do they allow transparent reference as type A, or must you disambiguate first?

That is, given a function that takes an A, can you pass it a type A+B, given that B is a subtype of A?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: