▲ | dkarl 3 days ago | ||||||||||||||||||||||||||||||||||
> But people tend to treat types more as what grade schools call units. And those act more as constraints on what you can do with the values. With you doing add/multiply on the values. Ah, I see. Yes, it doesn't make sense unless you see types as sets of values. I haven't been super deep into type theory, so I don't know how far that definition takes you, but it's the intuitive/naive starting place for understanding the idea of algebraic data types. The addition and multiplication operations are on sets of values and don't have anything to do with adding or multiplying the values themselves. | |||||||||||||||||||||||||||||||||||
▲ | taeric 3 days ago | parent [-] | ||||||||||||||||||||||||||||||||||
Thinking a little more about it, I would wager it would be a lot easier if people used the + and * when combining types. As things are, we say that that is what defines them being algebraic, but then never use + and *. Would be a lot easier if Maybe[String] was defined as [String + None] and similar. (I... don't actually know if that was classically done?) | |||||||||||||||||||||||||||||||||||
|