Skip to content

Commit

Permalink
Updated validating
Browse files Browse the repository at this point in the history
  • Loading branch information
labra committed Apr 25, 2021
1 parent 24d448d commit 373d8dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
7 changes: 1 addition & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ lazy val utilsRoot = project
.aggregate(typing, validating, utilsTest, utils, testsuite)
.settings(
ThisBuild / turbo := true,
cancelable in Global := true,
fork := true,
crossScalaVersions := Nil,
publish / skip := true,
ThisBuild / githubWorkflowBuild := Seq(
Expand Down Expand Up @@ -138,11 +136,10 @@ lazy val docs = project
mdocSettings,
ScalaUnidoc / unidoc / unidocProjectFilter := inAnyProject -- inProjects(noDocProjects: _*)
)
.dependsOn(utils)
.dependsOn(typing, validating, utilsTest, utils, testsuite)
.enablePlugins(MdocPlugin, DocusaurusPlugin, ScalaUnidocPlugin)

lazy val mdocSettings = Seq(
// mdoc := (Compile / run).evaluated,
mdocVariables := Map(
"VERSION" -> version.value
),
Expand All @@ -156,14 +153,12 @@ lazy val mdocSettings = Seq(
docusaurusPublishGhpages
.dependsOn(Compile / unidoc)
.value,
// format: off
ScalaUnidoc / unidoc / scalacOptions ++= Seq(
"-doc-source-url", s"https://github.com/weso/utils/tree/v${(ThisBuild / version).value}€{FILE_PATH}.scala",
"-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-title", "Utils",
"-doc-version", s"v${(ThisBuild / version).value}"
)
// format: on
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import data._
import cats.implicits._
import cats.effect.IO
import es.weso.utils.internal.CollectionCompat._
import scala.language.higherKinds

abstract class CheckerCats extends Checker {
implicit val logMonoid: Monoid[Log]
Expand Down Expand Up @@ -37,14 +38,15 @@ abstract class CheckerCats extends Checker {

def fromEither[A](e: Either[Err,A]): Check[A] = EitherT.fromEither[WriterEC](e)

def fromIO[A](io: IO[A]): Check[A] = EitherT.liftF(WriterT.liftF(Kleisli.liftF(Kleisli.liftF(io))))
def fromIO[A](io: IO[A]): Check[A] =
EitherT.liftF[WriterEC, Err, A](
WriterT.liftF[ReaderEC, Log, A](
Kleisli.liftF[ReaderConfig, Env, A](
Kleisli.liftF[IO,Config,A](io))))

def fromEitherIO[A](e: EitherT[IO,Err,A]): Check[A] = {
val ea: Check[Either[Err,A]] = EitherT.liftF(WriterT.liftF(ReaderT.liftF(ReaderT.liftF(e.value))))
for {
either <- ea
r <- either.fold(err(_), ok)
} yield r
// val ea: Check[Either[Err,A]] =
fromIO(e.value).flatMap(_.fold(err[A](_), ok))
}


Expand Down

0 comments on commit 373d8dc

Please sign in to comment.