-
Notifications
You must be signed in to change notification settings - Fork 50
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
FS-165 Module looks from Root #239
Conversation
We fix the bug reported with the module macro. Now the references to algebras types start with the _root_ base.
As an effect of the recent changes in `@module`, now it is not possible to have in a `tut` session an `@free` algebra and a `@module` that uses it. For this reason, we need to copy those algebras (or modules) to auxiliary scala files, and import them in the `tut` books.
Codecov Report
@@ Coverage Diff @@
## master #239 +/- ##
=======================================
Coverage 75.66% 75.66%
=======================================
Files 35 35
Lines 300 300
Branches 2 2
=======================================
Hits 227 227
Misses 73 73 |
@@ -17,7 +17,7 @@ libraryDependencies += "com.47deg" %% "freestyle-logging" % "0.1.0" | |||
|
|||
### Operations | |||
|
|||
The set of abstract operations of the `Logging` algebra are specified as follows: | |||
The set of abstract operations of the [`Logging` algebra](../../../../../../../freestyle-logging/shared/src/main/scala/logging.scala) are specified as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you click on this link on the microsite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run locally, it fails. It is intended to be use in github, as a link to the source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we used an absolute link (eg https://github.com/47deg/freestyle/blob/master/freestyle-logging/shared/src/main/scala/logging.scala
) it would work on the website as well, right?
Hmm, not being able to create a |
@@ -80,9 +83,11 @@ Abstract definitions it's all it takes to start building programs that support s | |||
The example below combines both algebras to produce a more complex program | |||
|
|||
```tut:book | |||
import cats.syntax.cartesian._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cats documentation choose to always use import cats.implicits._
instead of the piecemeal imports as it is more beginner friendly, should we do the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, it is more beginner-friendly to narrow down, as much as possible, what is it that the code snippet is using from this big cats
library. Not everybody may know all of cats
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was my initial point of view as well, but it is even more difficult to figure out where exactly which syntax is coming from before you know the relation between all the concepts Cats provides, see typelevel/cats#1026.
You can create a module, and the changes in the |
Creating a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are putting this on hold because fixing the FQN names creates the side effect of @module
not working in REPL environments. See comments on #165 for details
This has fallen far behind, and the problem may not be a major one. |
@diesalbla feel free to reopen if you consider this can be fixed now |
This PR addresses ticket #165. It modifies the
@module
macro, so that now it looks for theOp
types of the algebra using the `root prefix.One side effect of this changes is that it restricts the
@module
macro to use@free
or@module
traits with a definedpackage
, which excludes those defined in a Scala console session, or (for extension) in a tut book. For instance, pasting this to the console:would no longer work. For this reason we have to adapt the many
tut:book
items in thedocs
, adding a few Scala files.