sanctuary-js / sanctuary

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

update `is` to only work with concrete types #742

Closed davidchambers closed 9 months ago

davidchambers commented 9 months ago

This change is motivated by our desire to support tree shaking. create is the most problematic function, but is also depends on the environment.

This pull request makes is independent of the environment. This means that S.is ($.Array ($.TypeVariable ('a'))) no longer works, but I imagine no one has ever used this functionality. $.test is still available for advanced use cases, and is almost as convenient given that one must import sanctuary-def to create a type variable anyway.

Avaq commented 9 months ago

With the change we're envisioning for env, this may not even be necessary

davidchambers commented 9 months ago

With the change we're envisioning for env, this may not even be necessary

True. Even so, I'd like to simplify this function and rely on $.test in the rare situations in which type variables are needed.

davidchambers commented 9 months ago

I'm with you, Aldwin. There's no compelling reason to remove this fringe functionality given our plans for $.env and S.env.