Introduction
This is a short book about epimetheus a pure functional Prometheus integration for Scala.
Target Audience
This library is designed for people who are interested in typed, pure functional programming. If you are not a Cats or Cats-Effect user or are not familiar with functional I/O and monadic effects, you may need to go slowly and may want to spend some time reading Functional Programming in Scala, which introduces all of the ideas that you will find when exploring epimetheus.
Having said this, if you find yourself confused or frustrated by this documentation or the epimetheus API, please ask a question on Gitter, file an issue and ask for help. Both the library and the documentation are young and are changing quickly, and it is inevitable that some things will be unclear. Accordingly, this book is updated continuously to address problems and omissions.
Scala Setup
On the Scala side you just need a project with the proper dependencies. A minimal build.sbt
would look something like this.
The most recent stable version -
scalaVersion := "{{site.scalaVersion}}" // Scala {{site.scalaVersions}}
scalacOptions += "-Ypartial-unification" // 2.11.9+
lazy val epimetheusV = "{{site.epimetheusVersion}}"
libraryDependencies ++= Seq(
"io.chrisdavenport" %% "epimetheus" % epimetheusV
)
The -Ypartial-unification
compiler flag enables a bug fix that makes working with functional code significantly easier. See the Cats Getting Started for more info on this if it interests you.
Conventions
Each page begins with some imports, like this.
import cats._, cats.data._
import io.chrisdavenport.epimetheus._
After that there is text interspersed with code examples. Sometimes definitions will stand alone.
case class Person(name: String, age: Int)
val nel = NonEmptyList.of(Person("Bob", 12), Person("Alice", 14))
And sometimes they will appear as a REPL interaction.
nel.head
// res0: Person = Person(name = "Bob", age = 12)
nel.tail
// res1: List[Person] = List(Person(name = "Alice", age = 14))
Sometimes we demonstrate that something doesn't compile. In such cases it will be clear from the context that this is expected, and not a problem with the documentation.
woozle(nel) // doesn't compile
Many thanks to to the Book of Doobie for clearly outlining this.
Feedback and Contributions
Feedback on epimetheus or this book is genuinely welcome. Please feel free to file a pull request if you have a contribution, or file an issue, or chat with us on Gitter.