flatMap
method to reassociate binds to the right on construction and says that otherwise resume
can cause a stack overflow. However, without this, resume
still looks to be tail-recursive and I notice that the cats free implementation does not do this re-binding. Am I missing something?
Hello. I have a really strange compilation error when using freestyle library. My code compiles fine with Intellij IDEA and I can run, debug the app within the IDE. But when building with sbt it shows compilation error for accessing companion object of a module. Below are the code that gets error:
import freestyle.tagless._
// top most module
@module
trait Application[F[_]] {
// some smaller modules
val appA: ApplicationA[F]
}
@module ApplicationA[F[_]] {
// service dependencies
val service: Service[F]
}
// service code and interpreters …
@tagless(true)
trait Service[F[_]] { … }
// create instance of the app
type Program[A] = …
val app: Application[Program] = Application[Program] // error
// the last line is reported in sbt as "not found: value Application”
// [error] val app: Application[Program] = Application[Program]
// [error] ^
Does anyone see any issue similar to this?
freestyle
, perhaps you may want to check some of the examples we have in the repository.@tagless(true)
, which generates both the "tagless" representation as well as a Free-algebra (Called the StackSafe
). Naturally, the handler for the tagless
is also a handler for the free one.
FS
effect. But samples in http://frees.io/docs/core/algebras/ heavily use FS
effect. Is there any reason it's not used in examples?
So, the FS
is a generated type member of the "algebra" trait, which is used as an alias for the F[_]
type parameter
We added it at the time as a bit of syntactic sugar, to hide the F[_]
declaration:
@free trait Fili[F[_]] {
def kili: F[Int]
}
/////
@free trait Fili {
def kili: FS[Int]
}
But it is not essential to use the macro.
I am curious: are you trying to learn about freestyle for learning the theory? Or is it something you would like to apply to your work ?
cats-tagless
: that library has some better support for that style, with a few interesting constructors.