Optimizing type checks for point free compositions.
See original GitHub issueIn light of fantasy land’s move to prefixing, we’ll probably find ourselves using pipe
more frequently.
S.pipe
gives us a lot of information about types and code paths quite early. In #383 I’m positing that we may be able to get type errors before applying the value. Here I’d like to discuss potentially skipping type checks for all but the first sub-function application in a pipeline when a value is applied.
If we can assume the behaviour described in #383 is implemented, then we could theoretically assume that if an exception hasn’t thrown yet, that the pipeline is valid, and the only invalid case remaining is invalid input.
Again, this may not be feasible, but seems like a huge win for performance if it is possible. A lot of us will be composing point free S
functions in pipelines, it is the common case. So optimising that case seems valuable to me. Also both suggestions shouldn’t require any changes to sanctuary-def itself. It’s simply a sanctuary implementation concern.
I’d appreciate any critiques / thoughts / suggestions. 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
This is an interesting proposal. There are many Sanctuary-related tasks and features which I consider more important, though, so realistically any such change will need to come from another contributor. I’m happy to provide guidance and feedback to anyone interested in exploring these ideas.
I’m going to close this issue as it is not actionable, but you are all welcome to post additional comments.