Skip to content

Commit

Permalink
remove unnecessary parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jul 26, 2021
1 parent 3eacb9d commit a37d78d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions shared/src/main/scala/org/atnos/eff/Choose.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ object Rand {
}
}

def flatMap[A, B](fa: Rand[A])(f: (A) => Rand[B]): Rand[B] =
def flatMap[A, B](fa: Rand[A])(f: A => Rand[B]): Rand[B] =
Rand[B](rand => fa.run(rand).flatMap(f(_).run(rand)))

def tailRecM[A, B](a: A)(f: (A) => Rand[Either[A, B]]): Rand[B] =
def tailRecM[A, B](a: A)(f: A => Rand[Either[A, B]]): Rand[B] =
Rand[B] { random =>
Monad[Option].tailRecM(a)(f(_).run(random))
}
Expand Down
4 changes: 2 additions & 2 deletions shared/src/main/scala/org/atnos/eff/EvalEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ trait EvalInterpretation extends EvalTypes {
def pure[A](x: A): Eval[A] =
m.pure(x)

def flatMap[A, B](fa: Eval[A])(f: (A) => Eval[B]) =
def flatMap[A, B](fa: Eval[A])(f: A => Eval[B]) =
m.flatMap(fa)(f)

def tailRecM[A, B](a: A)(f: (A) => Eval[Either[A, B]]): Eval[B] =
def tailRecM[A, B](a: A)(f: A => Eval[Either[A, B]]): Eval[B] =
m.tailRecM(a)(f)

def raiseError[A](e: Throwable): Eval[A] =
Expand Down
6 changes: 3 additions & 3 deletions shared/src/main/scala/org/atnos/eff/FutureEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object TimedFuture {
def pure[A](x: A): TimedFuture[A] =
TimedFuture((_, _) => Future.successful(x))

def ap[A, B](ff: TimedFuture[(A) => B])(fa: TimedFuture[A]): TimedFuture[B] = {
def ap[A, B](ff: TimedFuture[A => B])(fa: TimedFuture[A]): TimedFuture[B] = {
val newCallback = { (scheduler: Scheduler, ec: ExecutionContext) =>
val ffRan = ff.runNow(scheduler, ec)
val faRan = fa.runNow(scheduler, ec)
Expand All @@ -45,10 +45,10 @@ object TimedFuture {
def pure[A](x: A): TimedFuture[A] =
TimedFuture((_, _) => Future.successful(x))

def flatMap[A, B](fa: TimedFuture[A])(f: (A) => TimedFuture[B]): TimedFuture[B] =
def flatMap[A, B](fa: TimedFuture[A])(f: A => TimedFuture[B]): TimedFuture[B] =
TimedFuture[B]((scheduler, ec) => fa.runNow(scheduler, ec).flatMap(f(_).runNow(scheduler, ec))(ec))

def tailRecM[A, B](a: A)(f: (A) => TimedFuture[Either[A, B]]): TimedFuture[B] =
def tailRecM[A, B](a: A)(f: A => TimedFuture[Either[A, B]]): TimedFuture[B] =
TimedFuture[B]({ (scheduler, ec) =>
def loop(va: A): Future[B] = f(va).runNow(scheduler, ec).flatMap {
case Left(na) => loop(na)
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/org/atnos/eff/ReaderEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ trait ReaderInterpretation {
*/
def translateReader[R, U, S, B, A](e: Eff[R, A], getter: B => S)
(implicit sr: Member.Aux[Reader[S, *], R, U],
br: (Reader[B, *]) |= U): Eff[U, A] =
br: Reader[B, *] |= U): Eff[U, A] =
translate(e) {
new Translate[Reader[S, *], U] {
def apply[X](r: Reader[S, X]): Eff[U, X] =
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/org/atnos/eff/StateEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ trait StateImplicits {
State((s: S1) => (s, r.run(s)))
}

def via[S, T](get: S => T, set: T => S => S): (State[T, *] ~> State[S, *]) =
def via[S, T](get: S => T, set: T => S => S): State[T, *] ~> State[S, *] =
new (State[T, *] ~> State[S, *]) {
def apply[X](s: State[T, X]) =
State[S, X] { s1 =>
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/org/atnos/eff/ValidateEffect.scala
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ trait ValidateInterpretation extends ValidateCreation {

/** catch and handle possible wrong values */
@deprecated("Use catchFirstWrong or more general catchWrongs instead", "5.4.2")
def catchWrong[R, E, A](effect: Eff[R, A])(handle: E => Eff[R, A])(implicit member: (Validate[E, *]) <= R): Eff[R, A] =
def catchWrong[R, E, A](effect: Eff[R, A])(handle: E => Eff[R, A])(implicit member: Validate[E, *] <= R): Eff[R, A] =
catchFirstWrong(effect)(handle)
}

Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/org/atnos/eff/syntax/reader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait reader {
ReaderInterpretation.runKleisli[R, U, S, A, F](env)(e)(mx, m)

def translateReader[U, S, B](getter: B => S)(implicit m1: Member.Aux[Reader[S, *], R, U],
m2: (Reader[B, *]) |= U): Eff[U, A] =
m2: Reader[B, *] |= U): Eff[U, A] =
ReaderInterpretation.translateReader[R, U, S, B, A](e, getter)(m1, m2)

def zoomReader[R2, U, S, T](f: T => S)(implicit readerS: Member.Aux[Reader[S, *], R, U],
Expand Down
4 changes: 2 additions & 2 deletions shared/src/test/scala/org/atnos/eff/MemberSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ for 4-element stacks:
type ReadStr[E] = Reader[String, *] /= E
type StateStr[E] = State[String, *] /= E

implicit def readerStateNat[S1]: (Reader[S1, *] ~> State[S1, *]) = new (Reader[S1, *] ~> State[S1, *]) {
implicit def readerStateNat[S1]: Reader[S1, *] ~> State[S1, *] = new (Reader[S1, *] ~> State[S1, *]) {
def apply[X](r: Reader[S1, X]): State[S1, X] =
State((s: S1) => (s, r.run(s)))
}

implicit def stateReaderNat[S1]: (State[S1, *] ~> Reader[S1, *]) = new (State[S1, *] ~> Reader[S1, *]) {
implicit def stateReaderNat[S1]: State[S1, *] ~> Reader[S1, *] = new (State[S1, *] ~> Reader[S1, *]) {
def apply[X](state: State[S1, X]): Reader[S1, X] =
Reader((s: S1) => state.runA(s).value)
}
Expand Down

0 comments on commit a37d78d

Please sign in to comment.