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

Add typealiases for public APIs datatypes #442

Merged
merged 13 commits into from
Nov 6, 2017
Merged

Conversation

tonilopezmr
Copy link
Member

@tonilopezmr tonilopezmr commented Nov 5, 2017

Added typealiases for the following datatypes:

  • Option: Some and None
  • Validated: Valid and Invalid
  • Try: Failure and Success
  • Either: Right and Left

Closes #300

@tonilopezmr tonilopezmr self-assigned this Nov 5, 2017
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.

Looks awesome but needs rebasing. Also I think we should not alias Eval types since those are not ment to be used directly but through the provided functions

@@ -1,5 +1,8 @@
package kategory

typealias Some<A> = Option.Some<A>

Choose a reason for hiding this comment

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

Why don't you just declare Some and None as top level?

Same is applicable to Left, Right and so on

Copy link
Member Author

Choose a reason for hiding this comment

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

Well I think we need a consistent API with all types inside their container. For example, Ior and Either have Left and Right types, and you can call them as Either.Right and Ior.Right without conflicts, also you should be able to call Some as Option.Some or just Some.

Choose a reason for hiding this comment

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

What's the point of typealiases then? Name clashing can be avoided by fully qualified imports. Long imports can be avoided by short package names :)

Copy link
Member

Choose a reason for hiding this comment

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

@artem-zinnatullin We want commonly used types available at the top level kategory.* package since many users will just import kategory.* to obtain syntax and type class instances. Users wanting just a subset of Kategory can still import a la carte types already and that will not change.

@codecov-io
Copy link

codecov-io commented Nov 6, 2017

Codecov Report

Merging #442 into master will not change coverage.
The diff coverage is 44.94%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #442   +/-   ##
=========================================
  Coverage     36.25%   36.25%           
  Complexity      320      320           
=========================================
  Files           174      174           
  Lines          4821     4821           
  Branches        523      523           
=========================================
  Hits           1748     1748           
  Misses         2925     2925           
  Partials        148      148
Impacted Files Coverage Δ Complexity Δ
...ptics/src/main/kotlin/kategory/optics/Traversal.kt 21.05% <ø> (ø) 0 <0> (ø) ⬇️
...rc/main/kotlin/kategory/laws/TraverseFilterLaws.kt 9.09% <ø> (ø) 1 <0> (ø) ⬇️
...main/kotlin/kategory/typeclasses/TraverseFilter.kt 20% <ø> (ø) 0 <0> (ø) ⬇️
...src/main/kotlin/kategory/laws/FunctorFilterLaws.kt 5.55% <0%> (ø) 1 <0> (ø) ⬇️
...ry-test/src/main/kotlin/kategory/laws/MonadLaws.kt 1.51% <0%> (ø) 2 <0> (ø) ⬇️
...test/src/main/kotlin/kategory/laws/OptionalLaws.kt 4.87% <0%> (ø) 1 <0> (ø) ⬇️
...ry-test/src/main/kotlin/kategory/laws/PrismLaws.kt 2.85% <0%> (ø) 1 <0> (ø) ⬇️
...tegory-core/src/main/kotlin/kategory/data/MapKW.kt 41.66% <0%> (ø) 5 <0> (ø) ⬇️
...gory-optics/src/main/kotlin/kategory/optics/Iso.kt 59.21% <100%> (ø) 0 <0> (ø) ⬇️
kategory-core/src/main/kotlin/kategory/data/Try.kt 20% <100%> (ø) 5 <0> (ø) ⬇️
... and 29 more

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 24b9600...699a696. Read the comment docs.

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.

thanks so much @tonilopezmr !

@raulraja raulraja merged commit a9d62a1 into master Nov 6, 2017
@raulraja raulraja deleted the toni-add-typealiases branch November 6, 2017 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants