Repository navigation
fix!: correct public typing contracts - #67
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the exported typing contracts usable from caller code and include the PEP 561 marker in the wheel.
MonadandApplicativenow name their concrete result containers, so structural assignments can be checked without widening the concrete APIs toAny. Add caller-side Pyright checks for the supported families.Correct the wrapped-function
applysignatures and add overloads for unary and two-argument functions. Two-argument application still curries; aTypeErrorraised inside a unary function now propagates instead of being mistaken for a currying request.Writer.mapnow transforms its value while preserving the log.Writer.map_with_logretains the old tuple-transforming operation.Writer.unitexposes its string-log default in its return type and acceptsempty_logfor other log types.Typing and API changes
Monad[T]becomesMonad[T, Result], whereResultis the concrete container returned bybind.Applicative[T]becomesApplicative[WrappedFunction, ArgumentContainer, ResultContainer].Functor[T]describes same-typemapoperations; concrete classes still type their value-changingmapmethods.Writer.mapcallback transforms(value, log)should useWriter.map_with_log.Writer.unit(value)is typed as returning a string-log writer. Passempty_logfor another log type, or use a writer class created withWriter.create.