Skip to content

Commit

Permalink
RDB Loader: bump cats to 1.1.0 (close #77)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuwy committed Jun 14, 2018
1 parent ddbde29 commit 9eaee79
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ object Dependencies {
val igluClient = "0.5.0"
val igluCore = "0.1.0"
val scalaTracker = "0.3.0"
val circeYaml = "0.6.1"
val circe = "0.8.0"
val cats = "0.9.0"
val circeYaml = "0.7.0"
val circe = "0.9.3"
val cats = "1.1.0"
val manifest = "0.1.0-M1"

// Scala (Shredder)
val spark = "2.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package com.snowplowanalytics.snowplow.rdbloader
package config

import cats._
import cats.data._
import cats.implicits._

Expand Down Expand Up @@ -140,7 +141,7 @@ object CliConfig {
val steps = Step.constructSteps(rawConfig.skip.toSet, rawConfig.include.toSet)
val folder = rawConfig.folder.map(f => S3.Folder.parse(f).leftMap(DecodingError).toValidatedNel).sequence

(target |@| config |@| logkey |@| folder).map {
(target, config, logkey, folder).mapN {
case (t, c, l, f) => CliConfig(c, t, steps, l, f, rawConfig.dryRun)
}
}
Expand All @@ -167,14 +168,15 @@ object CliConfig {
* @param resolverConfigB64 base64-encoded Iglu resolver config
* @param targetConfigB64 base64-encoded storage target JSON
* @return either aggregated list of errors (from both resolver and target)
* or successfuly decoded storage target
* or successfully decoded storage target
*/
private def loadTarget(resolverConfigB64: String, targetConfigB64: String) = {
val json = base64decode(resolverConfigB64).flatMap(Common.safeParse).toValidatedNel
val resolver = json.andThen(Compat.convertIgluResolver)
val decodedTarget = base64decode(targetConfigB64).toValidatedNel
(resolver |@| decodedTarget).tupled.andThen {
case (r, t) => StorageTarget.parseTarget(r, t)
}

Semigroupal[ValidatedNel[ConfigError, ?]] // Very disappointed tupled syntax didn't work
.product(resolver, decodedTarget)
.andThen { case (r, t) => StorageTarget.parseTarget(r, t) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ object SnowplowConfig {
* Codecs should be declared in exact this order (reverse of their appearence in class)
*/
private implicit val decoderConfiguration =
Configuration.default.withSnakeCaseKeys
Configuration.default.withSnakeCaseMemberNames

implicit val decodeTrackerMethod: Decoder[TrackerMethod] =
decodeStringEnum[TrackerMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ package object rdbloader {
/** Lift value into */
object LoaderAction {
def unit: LoaderAction[Unit] =
EitherT.liftT(Free.pure(()))
EitherT.liftF(Free.pure(()))

def lift[A](value: A): LoaderAction[A] =
EitherT.liftT(Free.pure(value))
EitherT.liftF(Free.pure(value))

def liftE[A](either: Either[LoaderError, A]): LoaderAction[A] =
EitherT(Free.pure(either))
Expand Down

0 comments on commit 9eaee79

Please sign in to comment.