sanctuary-js / sanctuary

:see_no_evil: Refuge from unsafe JavaScript
https://sanctuary.js.org
MIT License
3.03k stars 94 forks source link

Easy Question: Type Errors #583

Closed mwalkerwells closed 5 years ago

mwalkerwells commented 5 years ago
chain :: Chain m => (a -> m b) -> m a -> m b
                          ^^^     ^^^
                           1       2

1)  Future.of(Right ("Hello")) :: Future c (Either d String)
2)  Right ({ /*...*/ }) :: Either c Object, Either c (StrMap Object)
// ———————————————————————————————————————^

What does the comma mean? Union?

davidchambers commented 5 years ago

A value can be a member of multiple types. 0, for example, is a member of the following types:

These types are listed on a single line in error messages, separated by commas. For example:

S.toUpper (0);
// ! TypeError: Invalid value
//
//   toUpper :: String -> String
//              ^^^^^^
//                1
//
//   1)  0 :: Number, FiniteNumber, Integer, NonNegativeInteger, ValidNumber
//
//   The value at position 1 is not a member of ‘String’.
//
//   See https://github.com/sanctuary-js/sanctuary-def/tree/v0.18.1#String for information about the String type.
mwalkerwells commented 5 years ago

Ah, makes sense! Thank you!