ProductPromotion
Logo

Scala

made by https://0x3d.site

GitHub - frees-io/freestyle: A cohesive & pragmatic framework of FP centric Scala libraries
A cohesive & pragmatic framework of FP centric Scala libraries - frees-io/freestyle
Visit Site

GitHub - frees-io/freestyle: A cohesive & pragmatic framework of FP centric Scala libraries

GitHub - frees-io/freestyle: A cohesive & pragmatic framework of FP centric Scala libraries

Build Status codecov.io Maven Central Latest version License Join the chat at https://gitter.im/47deg/freestyle GitHub Issues Scala.js

Documentation

Full documentation available at http://frees.io

Build purely functional applications and libraries

Build stack-safe purely functional applications and libraries that support parallel and sequential computations where declaration is decoupled from interpretation. Freestyle encourages programs built atop Free algebras that are interpreted at the edge of your application ensuring effects are localized and performed in a controlled environment. Applications built with Freestyle can be interpreted to any runtime semantics supported by the interpreter target type.

import freestyle.free._

@free trait Database {
  def get(id: UserId): FS[User]
}

@free trait Cache {
  def get(id: UserId): FS[User]
}

@module trait Persistence {
  val database: Database
  val cache: Cache
}

Automatic Dependency Injection

Freestyle includes all the implicit machinery necessary to achieve seamless dependency injection of @free and @module Algebras. Simply require any of your @free or @module trait as implicits where needed.

def storedUsers[F[_]]
    (userId: UserId)
    (implicit persistence: Persistence[F]): FreeS[F, (User, User)] = {
  import persistence._
  for {
    cachedUser <- cache.get(userId)
    persistentUser <- database.get(userId)
  } yield (cachedUser, persistentUser)
}

Ready to use integrations

Freestyle ships with ready to use algebras and convenient syntax extensions covering most of the application concerns such as persistence, configuration, logging, etc. In addition Freestyle includes commonly used FP effects stack such as option, error, reader, writer, state based on the capabilities of the target runtime interpreters.

def loadUser[F[_]]
  (userId: UserId)
  (implicit
    doobie: DoobieM[F],
    logging: LoggingM[F]): FreeS[F, User] = {
    import doobie.implicits._
    for {
      user <- (sql"SELECT * FROM User WHERE userId = $userId"
                .query[User]
                .unique
                .liftFS[F])
      _ <- logging.debug(s"Loaded User: ${user.userId}")
    } yield user
}

Modules

  • freestyle - Core module including building blocks for boilerplate free FP programs and apps over Free monads and cats.

  • effects - MTL style effects such as reader, writer, state, error, and more modeled as free algebras.

  • logging - A purely functional logging algebra over Verizon's Journal.

  • cache - A generic cache with in memory and redis based implementations.

Integrations

  • fetch - Integration with the Fetch library for efficient data access from heterogenous datasources.

  • fs2 - Integration to run fs2 Streams in Freestyle programs.

  • monix - Instances and utilities to interpret to monix.eval.Task.

  • slick - Embedding of DBIO actions in Freestyle programs.

  • doobie - Embedding of Doobie ConnectionIO actions in Freestyle programs.

  • http - Adapters and marshallers to run the Freestyle program in endpoint return types for akka-http, finch, http4s and play.

Freestyle Artifacts

Freestyle is compatible with both Scala JVM and Scala.js.

This project supports Scala 2.11 and 2.12. The project is based on scalameta.

To use the project, add the following to your build.sbt:

addCompilerPlugin("org.scalameta" % "paradise" % "3.0.0-M11" cross CrossVersion.full)

For Scala.jvm:

// required
libraryDependencies += "io.frees" %% "frees-core"               % "0.8.2"

// optional - effects and patterns
libraryDependencies += "io.frees" %% "frees-effects"            % "0.8.2"
libraryDependencies += "io.frees" %% "frees-async"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-async-cats-effect"  % "0.8.2"
libraryDependencies += "io.frees" %% "frees-async-guava"        % "0.8.2"
libraryDependencies += "io.frees" %% "frees-cache"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-config"             % "0.8.2"
libraryDependencies += "io.frees" %% "frees-logging"            % "0.8.2"

// optional - integrations
libraryDependencies += "io.frees" %% "frees-cache-redis"        % "0.8.2"
libraryDependencies += "io.frees" %% "frees-doobie"             % "0.8.2"
libraryDependencies += "io.frees" %% "frees-fetch"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-akka"               % "0.8.2"
libraryDependencies += "io.frees" %% "frees-finch"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-http-client"        % "0.8.2"
libraryDependencies += "io.frees" %% "frees-http4s"             % "0.8.2"
libraryDependencies += "io.frees" %% "frees-monix"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-play"               % "0.8.2"
libraryDependencies += "io.frees" %% "frees-slick"              % "0.8.2"
libraryDependencies += "io.frees" %% "frees-twitter-util"       % "0.8.2"

For Scala.js:

// required
libraryDependencies += "io.frees" %%% "frees-core"              % "0.8.2"

// optional - effects and patterns
libraryDependencies += "io.frees" %%% "frees-effects"           % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-async"             % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-async-cats-effect" % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-async-fs2"         % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-async-monix"       % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-cache"             % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-http-client"       % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-logging"           % "0.8.2"

// optional - integrations
libraryDependencies += "io.frees" %%% "frees-fetch"             % "0.8.2"
libraryDependencies += "io.frees" %%% "frees-monix"             % "0.8.2"

Freestyle Examples

Commercial Support

47 Degrees offers commercial support for the Freestyle framework and associated technologies. To find out more, visit 47 Degrees' Open Source Support.

Copyright

Freestyle is designed and developed by 47 Degrees

Copyright (C) 2017-2018 47 Degrees. http://47deg.com

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory