Skip to content

Commit

Permalink
add explicit type (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k authored Sep 10, 2023
1 parent 1b126ac commit ff71a7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/shared/src/main/scala/cats/parse/Accumulator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ object Accumulator0 {
object Accumulator extends Priority0Accumulator {
implicit def nonEmptyListAccumulator0[A]: Accumulator[A, NonEmptyList[A]] =
new Accumulator[A, NonEmptyList[A]] {
def newAppender(first: A) =
def newAppender(first: A): Appender[A, NonEmptyList[A]] =
new Appender[A, NonEmptyList[A]] {
val bldr = List.newBuilder[A]
def append(item: A) = {
Expand All @@ -149,7 +149,7 @@ object Accumulator extends Priority0Accumulator {

implicit def nonEmptyVectorAccumulator0[A]: Accumulator[A, NonEmptyVector[A]] =
new Accumulator[A, NonEmptyVector[A]] {
def newAppender(first: A) =
def newAppender(first: A): Appender[A, NonEmptyVector[A]] =
new Appender[A, NonEmptyVector[A]] {
val bldr = Vector.newBuilder[A]
bldr += first
Expand Down
20 changes: 16 additions & 4 deletions core/shared/src/main/scala/cats/parse/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@

package cats.parse

import cats.{Eval, FunctorFilter, Monad, Defer, Alternative, FlatMap, Now, MonoidK, Order, Show}
import cats.{
Eval,
Functor,
FunctorFilter,
Monad,
Defer,
Alternative,
FlatMap,
Now,
MonoidK,
Order,
Show
}
import cats.data.{AndThen, Chain, NonEmptyList}

import cats.implicits._
Expand Down Expand Up @@ -2063,12 +2075,12 @@ object Parser {
implicit val catsInstancesParser
: FlatMap[Parser] with Defer[Parser] with MonoidK[Parser] with FunctorFilter[Parser] =
new FlatMap[Parser] with Defer[Parser] with MonoidK[Parser] with FunctorFilter[Parser] {
override def empty[A] = Fail
override def empty[A]: Parser[A] = Fail

override def defer[A](pa: => Parser[A]): Parser[A] =
Parser.this.defer(pa)

override def functor = this
override def functor: Functor[Parser] = this

override def map[A, B](fa: Parser[A])(fn: A => B): Parser[B] =
Parser.this.map(fa)(fn)
Expand Down Expand Up @@ -3596,7 +3608,7 @@ object Parser0 {

override def empty[A]: Parser0[A] = Parser.Fail

override def functor = this
override def functor: Functor[Parser0] = this

override def map[A, B](fa: Parser0[A])(fn: A => B): Parser0[B] = Parser.map0(fa)(fn)

Expand Down

0 comments on commit ff71a7a

Please sign in to comment.