Http4s
frameless
Our great sponsors
Http4s | frameless | |
---|---|---|
24 | 9 | |
2,505 | 868 | |
0.4% | -0.2% | |
9.8 | 8.2 | |
7 days ago | 7 days ago | |
Scala | Scala | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Http4s
-
How to get started?
http4s is a Typelevel project, and therefore falls into the "program in Scala as if it were Haskell" category. Many people find this off-putting, but honestly, I think with the resources listed above, this is the option at the best intersection of "mature" and "well-documented" available in Scala. The reason it's off-putting to many people is that Haskell-style pure FP isn't mainstream, so it isn't so much a matter of learning a new technology as it is a matter of learning a new paradigm, which necessarily means surfacing and unlearning things you already know, and perhaps confronting the uncomfortable feeling that things you thought were "fundamental," "have to be that way," aren't, and don't. I personally found this process liberating. But not everyone does.
-
Server Stack Options for Scala
If you want a mature REST API library, I recommend http4s. Be aware, though, that it’s based on purely-functional programming with Cats, cats-effect, and fs2, so if you’re not familiar with them or aren’t prepared to commit to the paradigm, the learning curve may be daunting, seem pointless, or both.
-
Sequential application of a constructor?
See also cats-effect and fs2. cats-effect gives you your IO Monad (and IOApp to run it with on supported platforms). fs2 is the ecosystem’s streaming library, which is much more pervasive in functional Scala than in Haskell. For example, http4s and Doobie are both based on fs2.
-
Grasping the concepts and getting them down to earth
Most important/known: * https://http4s.org/ - an HTTP client/server * https://github.com/typelevel/fs2 - streaming * https://github.com/tpolecat/doobie - JDBC
-
Relative popularity of programming languages on Hacker News
Scala devs are too busy wondering about free monads and F[Request[F] => Response[F]]. I am very pleased by http4s, Doobie, ScalaJS, and the whole ecosystem, really: https://http4s.org
-
http4s as a replacement for akka-http?
In reality, your performance issues will not be http4s, but something else. That being said, there are improvements that http4s can and is making, and I'm quite excited about the future 1.0 release, which has some important and fundamental performance improvements already, like a a 125% performance improvement on the plaintext benchmark from https://github.com/http4s/http4s/pull/6091 - and finally, yes, akka-http does have very good performance, but you can also get good performance out of http4s.
-
Is Scala a good choice for a data intensive web backend?
http4s for REST services.
-
Scala became Typelevel/Zio only ecosystem?
This is a long list of misunderstandings I don’t have the patience to unpack. Instead, let me refer you to the links in my top comment in the thread, then suggest you learn at least http4s, a purely-functional web service library that’s been used in production for a decade or so now.
-
Pleasant to use Scala libraries
The most popular nowadays are - I guess - akka-http and http4s. You can also use Play if you don't want to start from scratch but prefer a framework-based approach.
-
Why do all frameworks use OOP? (php)
There are functional frameworks: https://http4s.org/
frameless
-
for comprehension and some questions
I don't see how Spark is any "less controversial" when the Spark Delay instance for cats-effect takes an entire SparkSession implicitly.
-
Why use Spark at all?
To add to this I lately have used Spark with frameless for compile time safety and it's an interesting library that works well with Spark.
-
Guide for Apache Spark Setup, Job Optimisation, AWS EMR Cluster Configuration, S3, YARN and HDFS Optimisation
For type safety with dataframes, techniques like https://github.com/typelevel/frameless can be used.
-
Spark scala v/s pyspark
The preferred way to write Spark programs is to use DataFrame API which is untyped and is essentially the same in Scala, C# and Python. It's a DSL that's used to describe AST of the computation and the end result is the same regardless of language. There's a library called Frameless (https://github.com/typelevel/frameless) that implements typed DataFrame API but it is not in wide use, it looked dead for quite some time (though now development seems to continue) and didn't play nice with IntelliJ IDEA last time I checked. Performance-wise there's no difference most of the time (since all the program does is create an AST) except when using UDFs - Python UDFs are significantly slower and you can't write "proper" UDFs in Python - ones that generate Java code.
-
Does anyone here (intentionally) use Scala without an effects library such as Cats or ZIO? Or without going "full Haskell"?
Frameless is a nice way to grab some type safety back from Spark, and features opt-in Cats integration.
-
Making the Spark DataFrame composition type safe(r)
Valid point! Have you seen the withColumnTupled API? It returns a typed tuple instead. This seems to satisfy your use case - the dataset preserves its type and doesn't require a new case class. This is kind of what you're suggesting but without case class generation. Though not sure whether attribute labels (names) are preserved in this case. It's also unclear whether this is good enough for wide tables.
-
Recommendations for specializing in Spark (Scala)
I recommend using Frameless, which includes a Cats module. In general, I would encourage you to master “purely” functional programming first, because it’s foundational. Spark is a very specific technology, and probably not even the best in that class today—I would be very careful about trying to build a career around it.
What are some alternatives?
Akka HTTP - The Streaming-first HTTP server/module of Akka
Lantern
sttp - The Scala HTTP client you always wanted!
spark-excel - A Spark plugin for reading and writing Excel files
ZIO - ZIO — A type-safe, composable library for async and concurrent programming in Scala
deequ - Deequ is a library built on top of Apache Spark for defining "unit tests for data", which measure data quality in large datasets.
Finch.io - Scala combinator library for building Finagle HTTP services
azure-kusto-spark - Apache Spark Connector for Azure Kusto
zio-http - A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers
bebe - Filling in the Spark function gaps across APIs
Spray - A suite of scala libraries for building and consuming RESTful web services on top of Akka: lightweight, asynchronous, non-blocking, actor-based, testable
cats-effect - The pure asynchronous runtime for Scala