-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Check signature of function arguments #63
Comments
I appreciate the kind words, @jwoudenberg. You're absolutely right that I hope to have some time this weekend to work on this. It'll be useful in two open pull requests (sanctuary-js/sanctuary#142 and sanctuary-js/sanctuary#191) so it'll be very satisfying to eventually release a version of sanctuary-def which supports higher-order functions. My guess is it'll take me between 10 and 100 hours to complete the patch, so it's likely to take several weeks. @jackfirth opened sanctuary-js/sanctuary#157, a related issue with lots of interesting links. :) |
Hey @davidchambers, thanks for the extensive reply. The links contain a lot of interesting stuff, I'll read a bit and perhaps at some point I can contribute something myself. Nice to hear higher order functions are already on the radar. I can imagine it's not trivial to implement. I'll close this issue in favour of sanctuary-js/sanctuary#157 since it seems it's pretty much a duplicatie. |
Excellent. If at some point you'd like to contribute to Sanctuary, and you'd like to collaborate with someone familiar with the code in real time, leave a comment on sanctuary-js/sanctuary#209. :)
Actually, let's keep this issue open as it has a descriptive title and is in the "correct" issue tracker. |
Resolved via #79 |
Thanks for the great work on this so far! This lib is a joy to use and the error output is beautiful.
I think it would be cool to be able to specify the signature of a function arguments recursively:
Which could result in a TypeError looking like this:
What's nice about this is that it shows the full type signature of the monadic bind.
In case of the Maybe-monad of the example above, one could argue that this is not really necessary, as the current TypeError showing the output
Maybe b
having the wrong type is clear enough.However, I currently run into an issue with the chain operation of an IO monad that depends internally on
f
inio.chain(f)
returning another instance ofIO
. In this scenario, whenf
does not return anIO
,chain
will throw before a return type is generated forsanctuary-def
to check.To make things work, I'm currently wrapping
f
itself in anotherdef()
, which does the trick. However, I find the resulting TypeErrors harder to understand from the perspective of the library user because they do not contain the context of the fullchain
invocation, only the context off
itself (a -> Maybe b
).Looking forward to hearing your thoughts 😄.
The text was updated successfully, but these errors were encountered: