You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
S.I(['foo',42]);// ! TypeError: Type-variable constraint violation//// I :: a -> a// ^// 1//// 1) ["foo", 42] :: Array ???//// Since there is no type of which all the above values are members, the type-variable constraint has been violated.
If this is a case of array-as-list, a type error is appropriate. But perhaps it's a case of array-as-tuple?
sanctuary-def could—and should—provide Pair a b to support two-element arrays. The fact remains, though, that Sanctuary's environment cannot possibly include every type, as there are infinitely many.
Solution:
The user must have the ability to provide her own environment.
"Initializing" Sanctuary is currently done in one of two ways:
constS=require('sanctuary');
constS=require('sanctuary').unchecked;
If the user is to provide an environment, it makes sense to take (checkTypes :: Boolean, env :: [Type]) as $.create does:
When @Avaq and I discussed this on Gitter, he suggested having const S = require('sanctuary'); continue to work as it does today. This strikes me as a great idea, as it would allow new users to have a positive first experience with the library.
The text was updated successfully, but these errors were encountered:
Problem:
If this is a case of array-as-list, a type error is appropriate. But perhaps it's a case of array-as-tuple?
sanctuary-def could—and should—provide
Pair a b
to support two-element arrays. The fact remains, though, that Sanctuary's environment cannot possibly include every type, as there are infinitely many.Solution:
The user must have the ability to provide her own environment.
"Initializing" Sanctuary is currently done in one of two ways:
If the user is to provide an environment, it makes sense to take
(checkTypes :: Boolean, env :: [Type])
as$.create
does:When @Avaq and I discussed this on Gitter, he suggested having
const S = require('sanctuary');
continue to work as it does today. This strikes me as a great idea, as it would allow new users to have a positive first experience with the library.The text was updated successfully, but these errors were encountered: