Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Global / onChangedBuildSource := ReloadOnSourceChanges

lazy val scala212 = "2.12.10"
lazy val scala213 = "2.13.1"
lazy val scala212 = "2.12.12"
lazy val scala213 = "2.13.3"

def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scalaVersion: String): Seq[java.io.File] =
CrossVersion.partialVersion(scalaVersion) match {
Expand All @@ -13,8 +13,8 @@ def scalaVersionSpecificFolders(srcName: String, srcBaseDir: java.io.File, scala
lazy val baseSettings = Seq(
scalaVersion := scala213,
crossScalaVersions := Seq(scala212, scala213),
version := "3.0.0-RC6",
addCompilerPlugin("io.tryp" %% "splain" % "0.5.0" cross CrossVersion.patch),
version := "4.0.0-RC2",
addCompilerPlugin("io.tryp" %% "splain" % "0.5.7" cross CrossVersion.patch),
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.0" cross CrossVersion.patch),
scalacOptions ++= Seq("-P:splain:all", "-P:splain:keepmodules:500"),
scalacOptions --= Seq(
Expand All @@ -40,7 +40,7 @@ lazy val root = project.in(file("."))
bintrayReleaseOnPublish in ThisBuild := false
)

lazy val cats = Def.setting { "org.typelevel" %%% "cats-core" % "2.1.1" }
lazy val cats = Def.setting { "org.typelevel" %%% "cats-core" % "2.2.0" }
lazy val circe = "io.circe" %% "circe-core" % "0.13.0"
lazy val json4s = "org.json4s" %% "json4s-jackson" % "3.6.7"
lazy val playJson = "com.typesafe.play" %% "play-json" % "2.8.1"
Expand Down
1 change: 0 additions & 1 deletion jsdynamic-typify/src/main/scala/jsDynamicParsed.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scala.scalajs.js.typify

import cats.instances.option._
import cats.syntax.either._
import cats.syntax.option._
import cats.syntax.traverse._
Expand Down
4 changes: 2 additions & 2 deletions jsdynamic-typify/src/test/scala/CanParseProp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ object MakeJsDynamic extends MakeParsed[js.Dynamic] {
case MPOS => MPOS(v).map(x => literal(k -> x)).getOrElse(none)
case MPI => literal(k -> v)
case MPOI => MPOI(v).map(x => literal(k -> x)).getOrElse(none)
case MPL => literal(k -> v)
case MPOL => MPOL(v).map(x => literal(k -> x)).getOrElse(none)
case MPL => literal(k -> v.toDouble)
case MPOL => MPOL(v).map(x => literal(k -> x.toDouble)).getOrElse(none)
case MPD => literal(k -> v)
case MPOD => MPOD(v).map(x => literal(k -> x)).getOrElse(none)
case MPB => literal(k -> v)
Expand Down
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.8")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.13")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.32")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.2.0")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13")
7 changes: 3 additions & 4 deletions typify/shared/src/main/scala/typify/Cursor.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package typify

import cats.Applicative
import cats.instances.option._
import cats.kernel.Eq
import cats.syntax.eq._
import java.io.Serializable
Expand Down Expand Up @@ -32,13 +31,13 @@ sealed abstract class Cursor[A](
/**
* The operations that have been performed so far.
*/
final def history: CursorHistory[A] = {
@tailrec def go(res: CursorHistory[A], next: Option[Cursor[A]]): CursorHistory[A] = next match {
final def history: CursorHistory = {
@tailrec def go(res: CursorHistory, next: Option[Cursor[A]]): CursorHistory = next match {
case Some(c) => go(res :+ c.lastOp, c.lastCursor)
case None => res
}

go(CursorHistory.empty[A], Some(this))
go(CursorHistory.empty, Some(this))
}

/**
Expand Down
16 changes: 6 additions & 10 deletions typify/shared/src/main/scala/typify/CursorHistory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,27 @@ package typify

import cats.data.NonEmptyVector
import cats.Eq
import cats.instances.option._
import cats.instances.vector._
import cats.syntax.eq._

class CursorHistory[A](
final case class CursorHistory(
val successfulOps: Vector[CursorOp],
val failedOps: Option[NonEmptyVector[CursorOp]]
) {
override final def toString: String = s"CursorHistory($successfulOps, $failedOps)"

def success: Boolean = failedOps.isEmpty

def failedOp: Option[CursorOp] = failedOps.map(_.last)

def toVector: Vector[CursorOp] = failedOps.fold(Vector[CursorOp]())(_.toVector) ++ successfulOps

def :+(op: Either[CursorOp, CursorOp]): CursorHistory[A] =
def :+(op: Either[CursorOp, CursorOp]): CursorHistory =
op.fold(
f => new CursorHistory[A](successfulOps, Some(failedOps.fold(NonEmptyVector.of(f))(_ :+ f))),
s => new CursorHistory[A](successfulOps :+ s, failedOps))
f => copy(failedOps = Some(failedOps.fold(NonEmptyVector.of(f))(_ :+ f))),
s => copy(successfulOps = successfulOps :+ s))
}

object CursorHistory {
def empty[A]: CursorHistory[A] = new CursorHistory(Vector(), None)
lazy val empty: CursorHistory = CursorHistory(Vector(), None)

implicit def eqCursorHistory[A]: Eq[CursorHistory[A]] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was never an A ?

implicit val eqCursorHistory: Eq[CursorHistory] =
Eq.instance((a, b) => a.successfulOps === b.successfulOps && a.failedOps === b.failedOps)
}
Loading