scio-cats


License

License

GroupId

GroupId

io.regadas
ArtifactId

ArtifactId

scio-cats_2.11
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

scio-cats
scio-cats
Project URL

Project URL

https://github.com/regadas/scio-cats
Project Organization

Project Organization

regadas
Source Code Management

Source Code Management

https://github.com/regadas/scio-cats

Download scio-cats_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/io.regadas/scio-cats_2.11/ -->
<dependency>
    <groupId>io.regadas</groupId>
    <artifactId>scio-cats_2.11</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.regadas/scio-cats_2.11/
implementation 'io.regadas:scio-cats_2.11:0.1.1'
// https://jarcasting.com/artifacts/io.regadas/scio-cats_2.11/
implementation ("io.regadas:scio-cats_2.11:0.1.1")
'io.regadas:scio-cats_2.11:jar:0.1.1'
<dependency org="io.regadas" name="scio-cats_2.11" rev="0.1.1">
  <artifact name="scio-cats_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.regadas', module='scio-cats_2.11', version='0.1.1')
)
libraryDependencies += "io.regadas" % "scio-cats_2.11" % "0.1.1"
[io.regadas/scio-cats_2.11 "0.1.1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.12
org.typelevel : cats-core_2.11 jar 2.0.0

provided (1)

Group / Artifact Type Version
com.spotify : scio-core_2.11 jar 0.8.4

test (2)

Group / Artifact Type Version
com.spotify : scio-test_2.11 jar 0.8.4
org.scalatest : scalatest_2.11 jar 3.1.1

Project Modules

There are no modules declared in this project.

scio-cats

build GitHub license Maven Central

scio-cats is a collection of additional functions for scio SCollection that leverage cats type classes and data types.

Compatibility table

scio-cats scio
0.1.3 0.9.3
0.1.2 0.9.0
0.1.1 0.8.4
0.1.0 0.8.3

Quick Start

To use scio-cats add the following dependencies to your build.sbt:

libraryDependencies ++= Seq(
  "io.regadas" %% "scio-cats" % "<version>"
)

Examples

These are just few examples that show some of nicities of the added functions. Most of these functions have scaladoc with an example. Have a look.

Maping and filtering of F[A]

// before

scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  .map(_.map(_ + 1)) // Some(2), None, Some(3)
  .filter(_.exists(_ > 2)) // Some(3)

// after

import cats.implicits._
import io.regadas.scio.cats.syntax._

scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  .map_(_ + 1) // Some(2), None, Some(3)
  .filter_(_ > 2) // Some(3)

Creating tuples over F[A]

// before
scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  // here you could also use `cats` but it doesn't look as nice
  // .map(_.tupleRight(1))
  .map(_.map(_ -> 1)) // Some((1, 1)), Some((2, 1))

// after

import cats.implicits._
import io.regadas.scio.cats.syntax._

scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  // tupleLeft is also available
  .tupleRight(1) // Some((1, 1)), Some((2, 1))

Output to the console (similar to debug)

// before
scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  .debug() // it will use toString()

// after

import cats.implicits._
import io.regadas.scio.cats.syntax._

scioContext
  .parallelize(Seq(Some(1), None, Some(2)))
  .showStdOut // leverages Show type class

Versions

Version
0.1.1
0.1.0