Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
johnynek committed Jan 24, 2025
1 parent 574c385 commit 9e6174a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
12 changes: 6 additions & 6 deletions core/shared/src/main/scala/cats/parse/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1585,9 +1585,9 @@ object Parser {
case _ => Impl.SoftProd(first, second)
}

/**
* This implements the main method from the Align typeclass
*/
/** This implements the main method from the Align typeclass. This parses the first then maybe the
* second, or just the second. Put another way, it parses at least one of the arguments.
*/
def align[A, B](pa: Parser[A], pb: Parser[B]): Parser[Ior[A, B]] = {
val hasA = (pa ~ pb.?)
.map {
Expand All @@ -1600,9 +1600,9 @@ object Parser {
hasA | onlyB
}

/**
* This implements the main method from the Align typeclass
*/
/** This implements the main method from the Align typeclass This parses the first then maybe the
* second, or just the second. Put another way, it parses at least one of the arguments.
*/
def align0[A, B](pa: Parser0[A], pb: Parser0[B]): Parser0[Ior[A, B]] = {
val hasA = (pa ~ pb.?)
.map {
Expand Down
10 changes: 4 additions & 6 deletions core/shared/src/test/scala/cats/parse/ParserTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3073,22 +3073,21 @@ class ParserTest extends munit.ScalaCheckSuite {
case Left(a) => Left(Left(a))
case Right(bc) =>
bc match {
case Left(b) => Left(Right(b))
case Right(c) => Right(c)
case Left(b) => Left(Right(b))
case Right(c) => Right(c)
case Both(b, c) => Both(Right(b), c)
}
case Both(a, bc) =>
bc match {
case Left(b) => Left(Both(a, b))
case Right(c) => Both(Left(a), c)
case Left(b) => Left(Both(a, b))
case Right(c) => Both(Left(a), c)
case Both(b, c) => Both(Both(a, b), c)
}
}
}

property("align is associative") {
forAll(ParserGen.gen, ParserGen.gen, ParserGen.gen, arbitrary[String]) { (a, b, c, str) =>

val alignInst = cats.Align[Parser]
import alignInst.align

Expand All @@ -3101,7 +3100,6 @@ class ParserTest extends munit.ScalaCheckSuite {

property("align0 is associative") {
forAll(ParserGen.gen0, ParserGen.gen0, ParserGen.gen0, arbitrary[String]) { (a, b, c, str) =>

val alignInst = cats.Align[Parser0]
import alignInst.align

Expand Down

0 comments on commit 9e6174a

Please sign in to comment.