Skip to content

Commit d977d7c

Browse files
committed
StateT.liftR ⇒ liftS
1 parent 2bf445f commit d977d7c

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

HISTORY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ History
33

44
### 0.5.3 (unreleased)
55

6-
* Workaround for Scala's type inference failing with `StateT.liftR` on functions.
7-
Instead of `f(_).liftR`, `f.liftR` is now available and is confirmed to work in `_runState`.
6+
* Workaround for Scala's type inference failing with `StateT.liftS` on functions.
7+
Instead of `f(_).liftS`, `f._liftS` is now available and is confirmed to work in `_runState`.
88

99
### 0.5.2 ([commit log](https://github.com/japgolly/scalajs-react/compare/v0.5.1...v0.5.2))
1010

scalaz-7.0/src/main/scala/japgolly/scalajs/react/ScalazReact.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ object ScalazReact {
175175
}
176176

177177
implicit final class SzRExt_StateTOps[M[+_], S, A](val s: StateT[M, S, A]) extends AnyVal {
178-
@inline def liftR(implicit M: Functor[M]): ReactST[M, S, A] =
179-
ReactS lift s
178+
@deprecated("Instead of StateT.liftR use StateT.liftS. StateT.liftR will be removed in 0.7.0.", "0.5.3")
179+
@inline def liftR(implicit M: Functor[M]): ReactST[M, S, A] = s.liftS
180+
@inline def liftS(implicit M: Functor[M]): ReactST[M, S, A] = ReactS lift s
180181
}
181182

182183
implicit final class SzRExt__StateTOps[I, M[+_], S, A](val f: I => StateT[M, S, A]) extends AnyVal {
183-
@inline def liftR(implicit M: Functor[M]): I => ReactST[M, S, A] =
184-
f(_).liftR
184+
@inline def _liftS(implicit M: Functor[M]): I => ReactST[M, S, A] = f(_).liftS
185185
}
186186

187187
implicit final class SzRExt_ReactSTOps[M[+_], S, A](val s: ReactST[M,S,A]) extends AnyVal {
@@ -219,13 +219,13 @@ object ScalazReact {
219219
def _runState[I, M[+_], A](f: I => ReactST[M, S, A], cb: I => OpCallbackIO)(implicit C: CC, M: M ~> IO, N: Monad[M]): I => IO[A] =
220220
i => runState(f(i) addCallback cb(i))
221221

222-
@deprecated("Instead of runStateS(s) use runState(s.liftR). runStateS will be removed in 0.7.0.", "0.5.2")
222+
@deprecated("Instead of runStateS(s) use runState(s.liftS). runStateS will be removed in 0.7.0.", "0.5.2")
223223
def runStateS[M[+_], A](st: => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M]): IO[A] =
224-
runState(st.liftR)
224+
runState(st.liftS)
225225

226-
@deprecated("Instead of _runStateS(f), use _runState(f.liftR). _runStateS will be removed in 0.7.0.", "0.5.2")
226+
@deprecated("Instead of _runStateS(f), use _runState(f._liftS). _runStateS will be removed in 0.7.0.", "0.5.2")
227227
def _runStateS[I, M[+_], A](f: I => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M]): I => IO[A] =
228-
_runState(f(_).liftR)
228+
_runState(f._liftS)
229229

230230
def runStateF[M[+_], A](st: => ReactST[M, S, A])(implicit C: CC, M: M ~> IO, F: ChangeFilter[S]): IO[A] =
231231
run[M, A, A](st, (s1,s2,a,io) => if (F.allowChange(s1,s2)) io.map(_ => a) else IO(a))
@@ -236,13 +236,13 @@ object ScalazReact {
236236
def _runStateF[I, M[+_], A](f: I => ReactST[M, S, A], cb: I => OpCallbackIO)(implicit C: CC, M: M ~> IO, N: Monad[M], F: ChangeFilter[S]): I => IO[A] =
237237
i => runStateF(f(i) addCallback cb(i))
238238

239-
@deprecated("Instead of runStateFS(s) use runStateF(s.liftR). runStateFS will be removed in 0.7.0.", "0.5.2")
239+
@deprecated("Instead of runStateFS(s) use runStateF(s.liftS). runStateFS will be removed in 0.7.0.", "0.5.2")
240240
def runStateFS[M[+_], A](st: => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M], F: ChangeFilter[S]): IO[A] =
241-
runStateF(st.liftR)
241+
runStateF(st.liftS)
242242

243-
@deprecated("Instead of _runStateFS(f), use _runStateF(f.liftR). _runStateFS will be removed in 0.7.0.", "0.5.2")
243+
@deprecated("Instead of _runStateFS(f), use _runStateF(f._liftS). _runStateFS will be removed in 0.7.0.", "0.5.2")
244244
def _runStateFS[I, M[+_], A](f: I => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M], F: ChangeFilter[S]): I => IO[A] =
245-
_runStateF(f(_).liftR)
245+
_runStateF(f._liftS)
246246
}
247247

248248
case class ChangeFilter[S](allowChange: (S, S) => Boolean)

scalaz-7.1/src/main/scala/japgolly/scalajs/react/ScalazReact.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ object ScalazReact {
174174
}
175175

176176
implicit final class SzRExt_StateTOps[M[_], S, A](val s: StateT[M, S, A]) extends AnyVal {
177-
@inline def liftR(implicit M: Functor[M]): ReactST[M, S, A] =
178-
ReactS lift s
177+
@deprecated("Instead of StateT.liftR use StateT.liftS. StateT.liftR will be removed in 0.7.0.", "0.5.3")
178+
@inline def liftR(implicit M: Functor[M]): ReactST[M, S, A] = s.liftS
179+
@inline def liftS(implicit M: Functor[M]): ReactST[M, S, A] = ReactS lift s
179180
}
180181

181182
implicit final class SzRExt__StateTOps[I, M[_], S, A](val f: I => StateT[M, S, A]) extends AnyVal {
182-
@inline def liftR(implicit M: Functor[M]): I => ReactST[M, S, A] =
183-
f(_).liftR
183+
@inline def _liftS(implicit M: Functor[M]): I => ReactST[M, S, A] = f(_).liftS
184184
}
185185

186186
implicit final class SzRExt_ReactSTOps[M[_], S, A](val s: ReactST[M,S,A]) extends AnyVal {
@@ -218,13 +218,13 @@ object ScalazReact {
218218
def _runState[I, M[_], A](f: I => ReactST[M, S, A], cb: I => OpCallbackIO)(implicit C: CC, M: M ~> IO, N: Monad[M]): I => IO[A] =
219219
i => runState(f(i) addCallback cb(i))
220220

221-
@deprecated("Instead of runStateS(s) use runState(s.liftR). runStateS will be removed in 0.7.0.", "0.5.2")
221+
@deprecated("Instead of runStateS(s) use runState(s.liftS). runStateS will be removed in 0.7.0.", "0.5.2")
222222
def runStateS[M[_], A](st: => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M]): IO[A] =
223-
runState(st.liftR)
223+
runState(st.liftS)
224224

225-
@deprecated("Instead of _runStateS(f), use _runState(f.liftR). _runStateS will be removed in 0.7.0.", "0.5.2")
225+
@deprecated("Instead of _runStateS(f), use _runState(f._liftS). _runStateS will be removed in 0.7.0.", "0.5.2")
226226
def _runStateS[I, M[_], A](f: I => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M]): I => IO[A] =
227-
_runState(f(_).liftR)
227+
_runState(f._liftS)
228228

229229
def runStateF[M[_], A](st: => ReactST[M, S, A])(implicit C: CC, M: M ~> IO, F: ChangeFilter[S]): IO[A] =
230230
run[M, A, A](st, (s1,s2,a,io) => if (F.allowChange(s1,s2)) io.map(_ => a) else IO(a))
@@ -235,13 +235,13 @@ object ScalazReact {
235235
def _runStateF[I, M[_], A](f: I => ReactST[M, S, A], cb: I => OpCallbackIO)(implicit C: CC, M: M ~> IO, N: Monad[M], F: ChangeFilter[S]): I => IO[A] =
236236
i => runStateF(f(i) addCallback cb(i))
237237

238-
@deprecated("Instead of runStateFS(s) use runStateF(s.liftR). runStateFS will be removed in 0.7.0.", "0.5.2")
238+
@deprecated("Instead of runStateFS(s) use runStateF(s.liftS). runStateFS will be removed in 0.7.0.", "0.5.2")
239239
def runStateFS[M[_], A](st: => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M], F: ChangeFilter[S]): IO[A] =
240-
runStateF(st.liftR)
240+
runStateF(st.liftS)
241241

242-
@deprecated("Instead of _runStateFS(f), use _runStateF(f.liftR). _runStateFS will be removed in 0.7.0.", "0.5.2")
242+
@deprecated("Instead of _runStateFS(f), use _runStateF(f._liftS). _runStateFS will be removed in 0.7.0.", "0.5.2")
243243
def _runStateFS[I, M[_], A](f: I => StateT[M, S, A])(implicit C: CC, M: M ~> IO, N: Functor[M], F: ChangeFilter[S]): I => IO[A] =
244-
_runStateF(f(_).liftR)
244+
_runStateF(f._liftS)
245245
}
246246

247247
case class ChangeFilter[S](allowChange: (S, S) => Boolean)

test/src/test/scala/japgolly/scalajs/react/ScalazTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ object ScalazTest extends TestSuite {
2525
val c = null.asInstanceOf[ComponentScopeM[Unit, S, Unit]]
2626

2727
val tests = TestSuite {
28-
"runState(StateT.liftR)" - test[StateT[M,S,A] ](s => c.runState(s.liftR) ).expect[IO[A]]
29-
"_runState((I→StateT).liftR)" - test[B => StateT[M,S,A]](s => c._runState(s.liftR)).expect[B => IO[A]]
28+
"runState(s.liftS)" - test[StateT[M,S,A] ](s => c.runState(s.liftS) ).expect[IO[A]]
29+
"_runState(f._liftS)" - test[B => StateT[M,S,A]](s => c._runState(s._liftS)).expect[B => IO[A]]
3030
}
3131
}

0 commit comments

Comments
 (0)