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

Recursion schemes #237

Merged
merged 27 commits into from
Sep 13, 2017
Merged

Recursion schemes #237

merged 27 commits into from
Sep 13, 2017

Conversation

pakoito
Copy link
Member

@pakoito pakoito commented Aug 27, 2017

Magic. MAGIC. MAAAAGIIIIC.

@codecov-io
Copy link

codecov-io commented Aug 27, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@9c81e7a). Click here to learn what that means.
The diff coverage is 44.89%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #237   +/-   ##
=========================================
  Coverage          ?   44.95%           
  Complexity        ?      318           
=========================================
  Files             ?      148           
  Lines             ?     3733           
  Branches          ?      402           
=========================================
  Hits              ?     1678           
  Misses            ?     1934           
  Partials          ?      121
Impacted Files Coverage Δ Complexity Δ
...ion/src/main/kotlin/kategory/recursion/data/Fix.kt 0% <0%> (ø) 0 <0> (?)
...otlin/kategory/recursion/instances/FixInstances.kt 0% <0%> (ø) 0 <0> (?)
...test/src/main/kotlin/kategory/laws/TraverseLaws.kt 8.57% <0%> (ø) 1 <0> (?)
...kotlin/kategory/recursion/typeclass/Corecursive.kt 0% <0%> (ø) 0 <0> (?)
...on/src/main/kotlin/kategory/recursion/recursion.kt 0% <0%> (ø) 0 <0> (?)
...n/kotlin/kategory/recursion/typeclass/Recursive.kt 0% <0%> (ø) 0 <0> (?)
...gory-core/src/main/kotlin/kategory/data/EitherT.kt 48.88% <100%> (ø) 6 <1> (?)
...gory-core/src/main/kotlin/kategory/data/OptionT.kt 40.38% <100%> (ø) 7 <0> (?)
...e/src/main/kotlin/kategory/typeclasses/Composed.kt 69.87% <57.57%> (ø) 0 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c81e7a...16001dd. Read the comment docs.


init {
testLaws(FunctorLaws.laws(ComposedFunctor(Option.functor(), NonEmptyList.functor()), cf, EQ_OPTION_NEL))
testLaws(FunctorFilterLaws.laws(ComposedFunctorFilter(OptionT.functorFilter(Id.monad()), OptionT.functorFilter(NonEmptyList.monad())), { OptionT.pure(OptionT.pure(it, NonEmptyList.monad()), Id.monad()).lift() }, EQ_OPTIONT_ID_NEL))
testLaws(FunctorFilterLaws.laws(ComposedFunctorFilter(OptionT.functorFilter(Id.monad()), OptionT.functorFilter(NonEmptyList.monad())), { OptionT.pure(OptionT.pure(it, NonEmptyList.monad()), Id.monad()).nest() }, EQ_OPTIONT_ID_NEL))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should ComposedFunctorFilter be renamed to NestedFunctorFilter? Same for others that were previously under the Composed* names.

Copy link
Member

@raulraja raulraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is m,ind blowing, never imagined we'd be able to encode recursion schemes in Kotlin. I think it would be helpful to include examples and for all these new features they should come with some documentation as well.

@pakoito pakoito merged commit 0580ec7 into master Sep 13, 2017
@pakoito pakoito deleted the paco-recursionschemes branch September 13, 2017 22:53
@wiyarmir wiyarmir mentioned this pull request Sep 15, 2017
rachelcarmena pushed a commit that referenced this pull request Feb 24, 2021
rachelcarmena pushed a commit that referenced this pull request Feb 24, 2021
* Added a resolve function to Either.

* Processed some review comments.

* Added docs for catch and resolve functions.

* Improved docs for the resolve function.

* Inlined catch and resolve functions.

* Changed the implementation of the resolve function to not use default values for function parameters so that all function parameters can be inlined.

* Changed the handleItSafely function into catchAndFlatten.

* Made small improvement to tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants