frees-io / freestyle Goto Github PK
View Code? Open in Web Editor NEWA cohesive & pragmatic framework of FP centric Scala libraries
Home Page: http://frees.io/
License: Apache License 2.0
A cohesive & pragmatic framework of FP centric Scala libraries
Home Page: http://frees.io/
License: Apache License 2.0
Draft first approach to Cassandra Client lib in Freestyle
Free monads though practical in many use cases are not a silver bullet. We should include notes on performance and intended use cases in the docs with examples about overcoming some of the common antipatterns when apps rely heavily on Free for everything and the concerns around GC, etc.
I get a 404
. This is not the channel you're looking for.
When I add freestyle
as a dependency
libraryDependencies += "io.freestyle" %% "freestyle" % "0.1.0"
I get:
[error] (freestyle-example/*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: io.freestyle#freestyle_2.12;0.1.0: not found
The entire codebase is going to be reorganized to support top level imports such as import freestyle._
and import freestyle.implicits._
. All nested submodules and integrations will be under import freestyle.#name#
An implementation of the following potentially based on shapeless or with macros may allow us to have an auto cake style pattern based on trait composition and implicits. This can serve as an alternative to create @module
where they are just being created for dependencies. The grouping of Coproduct and synthetic members for result.T
would have to be taking into consideration as programs resulting from such combination would need an aligned Coproduct for interpretation.
implicit def autoInject[A, B](implicit a: A, b: B): A with B = ???
Use:
def program[F[_]](implicit C: AlgebraA with AlgebraB with ...)
We should update and publish the site docs under frees.io
and update the live site automatically when travis builds master successfully. Work in progress in #17
Add documentation for using fetch in freestyle programs, including tips on how to best use fetch together with freestyle.
In the same way the ErrorM
effect implements a fail fast strategy that immediately stops computation upon an error and relies on the presence of a MonadError
instance for M[_]
in the interpreter it should possible to have an algebra for Validation which places similar constrains.
In contrast to ErrorM
, ValidationM
should be able to accumulate errors and rely in something like MonadState
in the final interpreter to accumulate errors over the computation and make them available at any point in the program.
The ValidationM
algebra may tentatively look something like this:
trait ValidationProvider[E, A] {
@free trait ValidationM[F[_]] {
def valid(a: A): FreeS.Par[F, A] //lifts a valid value in the validation context
def invalid(a: A): FreeS.Par[F, Unit] //accumulates an error in the validation context
def validation: FreeS.Par[F, ValidatedNel[E, A]] // return the current state of the validation context
def errors: FreeS.Par[F, List[E]] // returns a list of errors from the validation context
}
}
Related to findings in #39 provide a POC that lifts smart constructors as RPC endpoints and allows some degree of composition.
We need a new logo for this library and a microsite design. I already have some ideas in mind.
Let's discuss tomorrow if you have some time @israelperezglez .
Research the possibility to include FS2 streams into freestyle's monadic flow. Similarly to the integration with Fetch, we can reify fs2 stream operations into an algebra an defer execution to the free monad interpretation.
When mentioning artifacts such as:
libraryDependencies += "io.freestyle" %%% "freestyle-effects" % "0.1.0"
we need to ensure that 0.1.0
is actually a placeholder derived from the latest released version.
We should provide a simple algebra with the most common operations for caching. This may be able to reutilize StateM
generic in the target type of the cache storage so we can build storages for common integrations such as Redis and other related libs in the caching space.
As part of the initiative to support newcommers that are not fully acquainted with FP in Scala we are gonna provide in each page a beginner / advance friendly split of each explained concept and areas covered by Freestyle
once the sbt-catalyst-extras
integration is in place we need to publish also as a JS library since Github4S and others also require this target.
You don't need to do anything special for it to "just work" in ensime and scala-ide, but you might find that you have bugs that break position information when the compiler enables them. I can try to help you fix it if the tests don't pass.
To ensure that you cover this use-case, please make sure to add a pcplod unit test https://github.com/ensime/pcplod
btw, I'm really looking forward to when this is ready for release, so I can use it in
https://github.com/fommil/drone-dynamic-agents/blob/master/src/main/scala/algebra.scala !
It seems that the link on the doc in the readme in not working. What is the URL of the doc?
Cheers,
Romain
Including potential existings framework integrations:
The home page layout will contain three main outlined features and needs a special jekyll style layout that integrates with sbt-microsite.
Draft first approach to Kafka Client lib in Freestyle
Currently each separate effects module includes its own object implicits
containing the implicit interpreters and syntax for each effect. We should have also a import freestyle.effects.implicits._
which brings into scope all implicits of all the effects. This also apply to other modules that may declare more than one algebra
Setup sbt-microsites based on #3
IDEA does not support macros. IDEA devs expect lib authors to create plugins such as the one for simulacrum
https://blog.jetbrains.com/scala/2015/10/14/intellij-api-to-build-scala-macros-support/
This Issue continues Issue#37, which is under Code Review in PR #70. The goal is to extend the algebra of CacheM
, with the operations that appear in the original comment.
For the Interpreter
backed on a ConcurrentHashMap
, the implementation should be based on the API for that class. For the Redis
-backed interpreter, the implementation should be based on the commands of redis
, and the client library rediscala
. Specially relevant would be the command scan
for efficiently iterating on the set of keys.
We need to provide an example of interpreting to a common stack such as Kleisli[Task, Config, A]
that supports most of the most common effects.
Including interpreting streams to FreeS[F, ?]
and support for fs2.Task
with the same semantics we are planning on supporting monix.Task
and scalaz.concurrent.Task
Configure snapshot auto-publishing for all successful master merges.
@fedefernandez @juanpedromoreno Can you help with this? Tried it locally but getting some errors after following the process doc. Can show you in person tomorrow.
I'm not using freestyle
yet, but it's indeed very appealing.
I have a similar logging algebra in a project of mine, and found it really useful to not instantiate Logger
directly in the body of the interpreter (https://github.com/47deg/freestyle/blob/master/freestyle-logging/jvm/src/main/scala/io/freestyle/loggingJVM.scala#L14), first compiling to Kleisli[F, Logger, A]
. It has several benefits, for example, that using your approach it'll take the first Manifest[C]
from the environment.
I propose something like follows:
def LogInterp[F[_] : MonadError[?[_], Throwable]](log: Logger): LogF ~> F = LogInterpK andThen KleisliInterp(log)
def KleisliInterp[F[_] : MonadError[?[_], Throwable]](log: Logger): Kleisli[F, Logger, ?] ~> F = λ[Kleisli[F, Logger, ?] ~> F](_.run(log))
def LogInterpK[F[_]](implicit ME: MonadError[F, Throwable]): LogF ~> Kleisli[F, Logger, ?] = new (LogF ~> Kleisli[F, Logger, ?]) {
def apply[A](logF: LogF[A]): Kleisli[F, Logger, A] = logF match {
case Debug(message) => Kleisli { log =>
ME.catchNonFatal(log.debug(message))
}
case Info(message) => Kleisli { log =>
ME.catchNonFatal(log.info(message))
}
case Warn(message) => Kleisli { log =>
ME.catchNonFatal(log.warn(message))
}
case Error(message) => Kleisli { log =>
ME.catchNonFatal(log.error(message))
}
}
}
Are you guys open for a PR?
We need to add docs that explain cache, implemented in #37
When we started freestyle scala meta and it's macro paradise support had issues with HKTs. Now that scala meta is becoming more stable we should consider dropping the macro code in favor of a version with Scala meta if possible.
Additionally we may have to write our own SBT task bound to compile
since the new version no longer has the format on compile setting.
We need to migrate new releases to the group id io.frees
Case class supports now derivation of codecs for product types so config can be mapped directly to things like classes. On top of that it supports also access to the most common combinators provided by libs like Typesafe Config and a module for shocon wich would allow us to remain compatible with ScalaJS //cc @andyscott
It's time to test the Kazari integration in the freestyle docs as we approach a first release in January.
Can I get some help integrating Kazari and seeing what it looks like or what potential issues may arise when a project such as Freestyle uses macros? thanks!
Add documentation showing how to integrate fs2 streams in freestyle programs. Also on how to use it together with fs2 streaming IO library.
Many other libs provide callback based APIs that we may be able to integrate in freestyle's monadic flow in some way. This is to track the need to research how that could be best integrated.
We need to add docs that explain how generated ADTs can be used to write natural transformations from 'Alg.T' to any target type and the compiler will show the missing cases. This should be explained in the context of writing custom interpreters when subclassing and implementing individual methods is less convenient.
It seems that when you want to use two provider style effects the implicits are not resolved.
For example effect.reader
and effect.writer
(with respectively EnvironmentProvider
and AccumulatorProvider
) :
val rd = reader[Config]
val wr = writer[Vector[String]]
@module trait App[F[_]] {
val persistence: Persistence[F]
val errorM: ErrorM[F]
val readerM: rd.ReaderM[F]
val writerM: wr.WriterM[F]
}
Results in something like :
diverging implicit expansion for type FunctionK[rd.ReaderM.T, Stack]
Tagless for ex.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.