Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this gets lost for Type.validate #220

Closed
dakom opened this issue Nov 8, 2018 · 1 comment
Closed

this gets lost for Type.validate #220

dakom opened this issue Nov 8, 2018 · 1 comment

Comments

@dakom
Copy link

dakom commented Nov 8, 2018

The following causes an exception to be thrown:

const validate = type => type.validate
validate ($.String) ("foo");

However, if we bind $.String.validate to give it the right this, it works:

const validate = type => type.validate;
$.String.validate = $.String.validate.bind($.String);
validate ($.String) ("foo");
@davidchambers
Copy link
Member

validate is currently a “private” method; I haven't given any thought to its ergonomics in contexts other than the sanctuary-def source code. I'm in favour of adding $.validate (as proposed in #219), which will obviate the need for usability improvements to this private method. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants