fantasyland / fantasy-land

Specification for interoperability of common algebraic structures in JavaScript
MIT License
10.11k stars 375 forks source link

What does "and" mean? #322

Closed fxkr closed 4 years ago

fxkr commented 4 years ago

From README.md:

image

Which of the following two interpretations is the right hand side of above statement referring to?

Where (Integer and Number) would be some kind of union type, constructed from the types Integer and Number using the and operator, or something? The and operator hasn't been introduced, so I am leaning towards taking first interpretation, but it says "type" (singular not plural), and also and is monospaced which both hints at the second interpretation.

Avaq commented 4 years ago

It means that 42 is a member of type Integer, as well as a member of type Number. So a member of two types.


If we would want to create an IntegerNumber type whose members are all the values that are members of Integer as well as Number, then the operator to use would be intersection (∩). So we could say: 42 is a member of type Integer ∩ Number. While also true, it's not what we wanted to convey. If a type "Integer ∩ Number" would exist, then 42 would be a member of Integer, Number, and Integer ∩ Number. So we're trying to make the reader aware of the full list of known types that a value is a member of.

davidchambers commented 4 years ago

Shall we update the wording to 42 is a member of the Integer and Number types?