-
Notifications
You must be signed in to change notification settings - Fork 443
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
Ensure all instances delegate to existing datatypes combinators. #75
Labels
Comments
Closed by #130 |
ambrusadrianz
pushed a commit
to ambrusadrianz/arrow
that referenced
this issue
Oct 22, 2019
rachelcarmena
added a commit
that referenced
this issue
Feb 24, 2021
* 0.11.0/bio (#1975) * BIO - Part 1 (#1851) * Add E param * Fix imports & types * Add RaiseError case * Refactor IO name * [BIO]: include `E` into IOFrame & IORunLoop (#1859) * Rewrite IOFrame * Update IORunLoop & fix resulting combinators * Move public code to IO.kt * Refactor Right to Success * IO: IOConnection & IOBracket (#1870) * Update ForwardCancelable * Update IOBracket * Remove KindConnection and refactor into IOConnection * IO Concurrency combinators & Green Build (#1892) * BIO - Part 1 (#1851) * Add E param * Fix imports & types * Add RaiseError case * Refactor IO name * [BIO]: include `E` into IOFrame & IORunLoop (#1859) * Rewrite IOFrame * Update IORunLoop & fix resulting combinators * Move public code to IO.kt * Refactor Right to Success * IO: IOConnection & IOBracket (#1870) * Update ForwardCancelable * Update IOBracket * Remove KindConnection and refactor into IOConnection * Rewrite UnsafePromise * Rewrite ParMap2 * Update IOParMap3 * Update IORacePair * Update IORaceTriple * Fix tests * Fix KIO benchmarks * Fix imports Ank * Fix IOExample * Fix unused imports * Fix imports benchmarks * Fix arrow-integrations-retrofit-adapter * Fix FpToTheMax & typeclasses example * KtLintFormat * Fix IOTest * Fix more tests * Fix merge conflicts * KtLintFormat * Fix MaybeK bracket and use it for QueueTest * Throw proper exception in impossible cases * Revert removing runAsync * Fix build * KtLintFormat * Update version * Conf: separate 0.11.0 version * Fix doc generation and validation failures (#75) * After releasing 0.10.5: just considering one wip version (#76) Co-authored-by: Simon Vergauwen <nomisRev@users.noreply.github.com> Co-authored-by: Simon Vergauwen <vergauwen.simon@gmail.com> Co-authored-by: raulraja <raulraja@users.noreply.github.com>
rachelcarmena
added a commit
that referenced
this issue
Feb 24, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's common to stack overflow if instances of Monad for example don't provide overrides that delegate to the Datatype impl which is usually the shortest and more efficient path.
For example when creating an instance for
Monad
and your datatype containsmap
,ap
and others, do not let the methods in the Monad hierarchy to stay autoimplemented and provide instead overrides that delegate to the datatype because the default implementations are usually non-effitient and can lead to stack overflow errors.For example Monad implements
ap
in terms offlatMap
, and Applicative implementsmap
in terms ofap
. While this may be ok for simple datatypes it's gonna blow up in cases such as EitherT and other more complex ones.Each datatype should have separate classes for each instance it implements for example. Instead of having a single
IdMonad
we should haveIdMonad: IdApplicative
andIdApplicative: IdFunctor
and so on where in each class there is a delegation of the corresponding methods to the ones present in the datatype.The text was updated successfully, but these errors were encountered: