Pinned Loading
-
Understanding fs2 `Pull`
Understanding fs2 `Pull` 1# Undertsanding the `Pull` type from fs2
23## From the scaladocs
45```scala
-
Example of Contravariant Predicate
Example of Contravariant Predicate 1import $ivy.`org.typelevel::cats-core:1.5.0`
2import cats.Contravariant
3import cats.implicits._
45{
-
A Streaming library with a superpow...
A Streaming library with a superpower: Functional Programming 1# A Streaming library with a superpower: Functional Programming
23Scala has a very unique streaming library called FS2 (Functional Streams for Scala).
4This library embodies all the advantages of functional programming(FP).
5By understanding its design goals you will get exposure to the core ideas that makes FP so appealing.
-
Lift a non safe function to a safe one
Lift a non safe function to a safe one 1def notSafeFunc: String => Int = _.toInt
2notSafeFunc("1") // 1
3notSafeFunc("a") // java.lang.NumberFormatException: For input string: "a"
4import $ivy.`org.typelevel::cats-core:1.5.0`
5import cats.implicits._
-
haskell flip in Scala
haskell flip in Scala 1def flip[A,B,C]: (A => B => C) => (B => A => C) = f => x => y => f(y)(x)
2def f: Int => String => Int= a => b => a + b.toInt
3flip(f)("1")(2)
4def ++ : String => String => String = a => b => a + b
5flip(++)("Hello")("World")
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.