Skip to content

Migrate classes to new package structure#748

Merged
janstenpickle merged 16 commits intomasterfrom
module-reorg-part2
May 28, 2022
Merged

Migrate classes to new package structure#748
janstenpickle merged 16 commits intomasterfrom
module-reorg-part2

Conversation

@janstenpickle
Copy link
Copy Markdown
Collaborator

Addresses #744

@catostrophe
Copy link
Copy Markdown
Member

@janstenpickle do you need help with this PR?

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

@janstenpickle do you need help with this PR?

Sorry, I've been really busy the last couple of week. Yes please feel free to commit to this branch if you have some time!

@janstenpickle janstenpickle marked this pull request as ready for review May 20, 2022 14:02
@janstenpickle
Copy link
Copy Markdown
Collaborator Author

Hopefully I've got everything now 😅

@janstenpickle janstenpickle requested a review from catostrophe May 20, 2022 14:03
@janstenpickle
Copy link
Copy Markdown
Collaborator Author

@bplommer how does this new structure look to you?

@catostrophe
Copy link
Copy Markdown
Member

Will review tonight

package object trace4cats {
type SpanName = String
type SpanParams = (SpanName, SpanKind, TraceHeaders, ErrorHandler)
type ResourceKleisli[F[_], -In, +Out] = Kleisli[Resource[F, +*], In, Out @uncheckedVariance]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was going to suggest renaming ResourceKleisli to something that reflects purpose rather than implementation, and possibly changing it from a type alias to part of a class heirarchy with EntryPoint. But again, not something that should happen in this PR - just mentioning it while I remember

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The main reason for not making this its own class is that we get a lot of things for free with Kleisli and its input and output aren't fixed to the input/output of the entry point. This allows us to compose the entrypoint with other means of establishing some context from some input. There's an example of this in the http4s library.

@bplommer
Copy link
Copy Markdown
Contributor

Looks good! I wonder if types from model should also be aliased in the main package object?

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

Looks good! I wonder if types from model should also be aliased in the main package object?

Yes, that might be handy for things like the IDs and context, I'll take a look.

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

@bplommer @catostrophe how does this look to you both now, shall I merge?

I've got a scalafix branch in progress at the moment as well, so once the other repos are done we should be getting close to a release

@catostrophe
Copy link
Copy Markdown
Member

Sorry for being so slow, been busy at $WORK. Checking now...

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

Sorry for being so slow, been busy at $WORK. Checking now...

No problem, I know the feeling!

Copy link
Copy Markdown
Member

@catostrophe catostrophe left a comment

Choose a reason for hiding this comment

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

Why trace4catstests?

package io.janstenpickle.trace4cats.base.context
package laws
package discipline
package trace4catstests.context.laws.discipline
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it intended? 🤔

import cats.~>
import org.scalacheck.Cogen
import trace4cats.context.Unlift
import trace4catstests.context.laws.discipline.UnliftTests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

import trace4cats.context.iolocal.GenIO
import trace4cats.context.iolocal.instances.ioLocalProvide
import trace4cats.context.laws.BaseSuite
import trace4catstests.context.laws.discipline.ProvideTests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

Why trace4catstests?

@catostrophe - It was suggested by @bplommer. Sorry, I resolved the comment so you wouldn't have seen it!

@catostrophe
Copy link
Copy Markdown
Member

Why trace4catstests?

@catostrophe - It was suggested by @bplommer. Sorry, I resolved the comment so you wouldn't have seen it!

I still haven't got the idea behind it.

I've never seen such a separation before in the context of discipline and law tests. Instead, laws and tests are usually in the same namespace and are close enough, because, if they are ever edited, they are edited together.

See:
https://github.com/typelevel/cats/tree/main/kernel-laws/shared/src/main/scala/cats/kernel/laws/discipline
https://github.com/typelevel/cats-tagless/tree/master/laws/src/main/scala/cats/tagless/laws/discipline
https://github.com/typelevel/cats-effect/tree/series/3.x/laws/shared/src/main/scala/cats/effect/laws

@catostrophe
Copy link
Copy Markdown
Member

catostrophe commented May 27, 2022

These "tests" are actually rule sets that you use in real tests to check some concrete implementation for satisfying them.

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

I've never seen such a separation before in the context of discipline and law tests. Instead, laws and tests are usually in the same namespace and are close enough, because, if they are ever edited, they are edited together.

I've got to admit I took the recommendation at face value. I wonder if you were thinking more of the separate test modules rather than discipline tests @bplommer?

@bplommer
Copy link
Copy Markdown
Contributor

I've got to admit I took the recommendation at face value. I wonder if you were thinking more of the separate test modules rather than discipline tests @bplommer?

Yes, afraid I didn't look very closely before suggesting that. Anything that's going to be published as an artifact, I'd leave in the trace4cats package.

@catostrophe
Copy link
Copy Markdown
Member

Could we revert the introduction of trace4catstests package?

The rest is fine 👍

@janstenpickle
Copy link
Copy Markdown
Collaborator Author

Could we revert the introduction of trace4catstests package?

The rest is fine 👍

Cool, I'll revert this now then merge. Thanks all!

@janstenpickle janstenpickle merged commit 8ded233 into master May 28, 2022
@janstenpickle janstenpickle deleted the module-reorg-part2 branch May 28, 2022 13:14
@catostrophe catostrophe added the enhancement New feature or request label May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants