SignallingRef

fs2.concurrent.SignallingRef$
See theSignallingRef companion class
object SignallingRef

Attributes

Companion
class
Source
Signal.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[F[_]]: PartiallyApplied[F]

Builds a SignallingRef value for data types that are Concurrent.

Builds a SignallingRef value for data types that are Concurrent.

This builder uses the Partially-Applied Type technique.

 SignallingRef[IO].of(10L) <-> SignallingRef.of[IO, Long](10L)

Attributes

See also

State.this._1 case1=> State.this._2 case2=> State.this._3 case_=> thrownewIndexOutOfBoundsException(n.toString()) } } objectStateextendsAnyRefwithProduct{ overridedeftoString:String="State" typeMirroredMonoType deffromProduct(`x$0₃`:Product):MirroredMonoType=newState(`x$0₃`.productElement(0).$asInstanceOf$[A],`x$0₃`.productElement(1).$asInstanceOf$[Long],`x$0₃`.productElement(2).$asInstanceOf$[LongMap[Deferred[F,Tuple2[A,Long]]]]) } toFunctorOps[F,Tuple2[Ref[F,State],Ref[F,Long]]](catsSyntaxSemigroupal[F,Ref[F,State]](F.ref[State](State.apply(initial,0L,LongMap.empty[Deferred[F,Tuple2[A,Long]]])))(F).product[Ref[F,Long]](F.ref[Long](1L)))(F).map[SignallingRef[F,A]](((x$1:Tuple2[Ref[F,State],Ref[F,Long]])=>x$1match{ caseTuple2(state,ids)=> defnewId:F[Long]=ids.getAndUpdate(((_$13:Long)=>_$13.+(1))) defupdateAndNotify[B](state:State,f:Function1[A,Tuple2[A,B]]):Tuple2[State,F[B]]={ val$2$:Tuple2[A,B]=(f.apply(state.value):@unchecked)match{ caseTuple2(newValue,result)=> Tuple2.apply[A,B](newValue,result) } val`newValue₂`:A=$2$._1 val`result₂`:B=$2$._2 val`lastUpdate₂`:Long=state.lastUpdate.+(1) valnewState:State=State.apply(`newValue₂`,`lastUpdate₂`,LongMap.empty[Deferred[F,Tuple2[A,Long]]]) valnotifyListeners:F[Unit]=toFoldableOps[Vector,Deferred[F,Tuple2[A,Long]]](state.listeners.values.toVector)(catsTraverseForVector).traverse_[F,Boolean](((listener:Deferred[F,Tuple2[A,Long]])=>listener.complete(ArrowAssoc[A](`newValue₂`).->[Long](`lastUpdate₂`))))(F) ArrowAssoc[State](newState).->[F[B]](toFunctorOps[F,Unit](notifyListeners)(F).as[B](`result₂`)) } { finalclass$anon()extendsSignallingRef[F,A]{ defget:F[A]=toFunctorOps[F,State](`state₂`.get)(F).map[A](((_$14:State)=>_$14.value)) defcontinuous:Stream[F,A]=Stream.repeatEval[F,A]($anon.this.get) defdiscrete:Stream[F,A]=Stream.resource[F,Tuple2[A,Stream[F,A]]]($anon.this.getAndDiscreteUpdates(F))(F).flatMap[F,A](((`x$1₂`:Tuple2[A,Stream[F,A]])=>`x$1₂`match{ caseTuple2(a,updates)=> Stream.emit[[x>:Nothing<:Any]=>Pure[x],A](a).++[F,A](updates) }))(value) overridedefgetAndDiscreteUpdates(implicitev:Concurrent[F]):Resource[F,Tuple2[A,Stream[F,A]]]=$anon.this.getAndDiscreteUpdatesImpl defgetAndDiscreteUpdatesImpl:Resource[F,Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]]={ defgo(id:Long,lastSeen:Long):Stream[F,A]={ defgetNext:F[Tuple2[A,Long]]=catsSyntaxFlatten[F,Tuple2[A,Long]](toFlatMapOps[F,Deferred[F,Tuple2[A,Long]]](F.deferred[Tuple2[A,Long]])(F).flatMap[F[Tuple2[A,Long]]](((wait:Deferred[F,Tuple2[A,Long]])=>`state₂`.modify[F[Tuple2[A,Long]]](((`x$1₃`:State)=>`x$1₃`match{ casestate@State(value,lastUpdate,listeners)=> if(`lastUpdate₃`.!=(lastSeen))ArrowAssoc[State](`state₃`).->[F[Tuple2[A,Long]]](catsSyntaxApplicativeId[Tuple2[A,Long]](ArrowAssoc[A](`value₂`).->[Long](`lastUpdate₃`)).pure[F](F))elseArrowAssoc[State]({ vallisteners$1:LongMap[Deferred[F,Tuple2[A,Long]]]=`listeners₂`.+[Deferred[F,Tuple2[A,Long]]](ArrowAssoc[Long](id).->[Deferred[F,Tuple2[A,Long]]](wait)) valvalue$1:A@uncheckedVariance=`state₃`.copy$default$1 vallastUpdate$1:Long@uncheckedVariance=`state₃`.copy$default$2 `state₃`.copy(value$1,lastUpdate$1,listeners=listeners$1) }).->[F[Tuple2[A,Long]]](wait.get) })))))(F).flatten(F) Stream.eval[F,Tuple2[A,Long]](getNext).flatMap[F,A](((`x$1₄`:Tuple2[A,Long])=>`x$1₄`match{ caseTuple2(a,lastUpdate)=> Stream.emit[[x>:Nothing<:Any]=>Pure[x],A](`a₂`).++[F,A](go(id,lastSeen=`lastUpdate₄`)) }))(value) } defcleanup(`id₂`:Long):F[Unit]=`state₂`.update(((s:State)=>{ vallisteners$2:LongMap[Deferred[F,Tuple2[A,Long]]]=s.listeners.-(`id₂`) valvalue$2:A@uncheckedVariance=s.copy$default$1 vallastUpdate$2:Long@uncheckedVariance=s.copy$default$2 s.copy(value$2,lastUpdate$2,listeners=listeners$2) })) Resource.eval[F,Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]](toFunctorOps[F,State](`state₂`.get)(F).map[Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]](((`s₂`:State)=>Tuple2.apply[A,Stream[[x>:Nothing<:Any]=>F[x],A]](`s₂`.value,Stream.bracket[F,Long](newId)(((`id₃`:Long)=>cleanup(`id₃`))).flatMap[[x>:Nothing<:Any]=>F[x],A](((_$15:Long)=>go(_$15,`s₂`.lastUpdate)))(value))))) } defset(`a₃`:A):F[Unit]=$anon.this.update(((_$16:A)=>`a₃`)) defupdate(`f₂`:Function1[A,A]):F[Unit]=$anon.this.modify[Unit](((`a₄`:A)=>Tuple2.apply[A,Unit](`f₂`.apply(`a₄`),()))) defmodify[B](`f₃`:Function1[A,Tuple2[A,B]]):F[B]=`state₂`.flatModify[B](((_$17:State)=>updateAndNotify[B](_$17,`f₃`)))(F) deftryModify[B](`f₄`:Function1[A,Tuple2[A,B]]):F[Option[B]]=monadCancelOps_[F,Option[B]](toFlatMapOps[F,Option[F[B]]](`state₂`.tryModify[F[B]](((_$18:State)=>updateAndNotify[B](_$18,`f₄`))))(F).flatMap[Option[B]](((_$19:Option[F[B]])=>toTraverseOps[Option,F[B]](_$19)(catsTraverseForOption).sequence[F,B](refl[F[B]],F)))).uncancelable(F) deftryUpdate(`f₅`:Function1[A,A]):F[Boolean]=toFunctorOps[F,Option[Unit]]($anon.this.tryModify[Unit](((`a₅`:A)=>Tuple2.apply[A,Unit](`f₅`.apply(`a₅`),()))))(F).map[Boolean](((_$20:Option[Unit])=>_$20.isDefined)) defaccess:F[Tuple2[A,Function1[A,F[Boolean]]]]=toFunctorOps[F,Tuple2[State,Function1[State,F[Boolean]]]](`state₂`.access)(F).map[Tuple2[A,Function1[A,F[Boolean]]]](((`x$1₅`:Tuple2[State,Function1[State,F[Boolean]]])=>`x$1₅`match{ caseTuple2(state,set)=> valsetter:Function1[A,F[Boolean]]=((`newValue₃`:A)=>{ val$3$:Tuple2[State,F[Unit]]=(updateAndNotify[Unit](`state₄`,((_$21:A)=>Tuple2.apply[A,Unit](`newValue₃`,()))):@unchecked)match{ caseTuple2(newState,notifyListeners)=> Tuple2.apply[State,F[Unit]](`newState₂`,`notifyListeners₂`) } val`newState₃`:State=$3$._1 val`notifyListeners₃`:F[Unit]=$3$._2 toFlatMapOps[F,Boolean](set.apply(`newState₃`))(F).flatTap[Unit](((succeeded:Boolean)=>catsSyntaxApplicativeByName[F,Unit](`notifyListeners₃`).whenA(succeeded)(F))) }) Tuple2.apply[A,Function1[A,F[Boolean]]](`state₄`.value,setter) })) deftryModifyState[B](`state₅`:cats.data.State[A,B]):F[Option[B]]={ val`f₆`:Function1[A,Eval[Tuple2[A,B]]]=`state₅`.runF.value $anon.this.tryModify[B](((`a₆`:A)=>`f₆`.apply(`a₆`).value)) } defmodifyState[B](`state₆`:cats.data.State[A,B]):F[B]={ val`f₇`:Function1[A,Eval[Tuple2[A,B]]]=`state₆`.runF.value $anon.this.modify[B](((`a₇`:A)=>`f₇`.apply(`a₇`).value)) } } (new$anon():SignallingRef[F,A]) } })) }">of

Source
Signal.scala
def apply[F[_] : Concurrent, A](initial: A): F[SignallingRef[F, A]]

Alias for of.

Alias for of.

Attributes

Source
Signal.scala
def lens[F[_], A, B](ref: SignallingRef[F, A])(get: A => B, set: A => B => A)(implicit F: Functor[F]): SignallingRef[F, B]

Creates an instance focused on a component of another SignallingRef's value. Delegates every get and modification to underlying SignallingRef, so both instances are always in sync.

Creates an instance focused on a component of another SignallingRef's value. Delegates every get and modification to underlying SignallingRef, so both instances are always in sync.

Attributes

Source
Signal.scala
def State.this._1 case1=> State.this._2 case2=> State.this._3 case_=> thrownewIndexOutOfBoundsException(n.toString()) } } objectStateextendsAnyRefwithProduct{ overridedeftoString:String="State" typeMirroredMonoType deffromProduct(`x$0₃`:Product):MirroredMonoType=newState(`x$0₃`.productElement(0).$asInstanceOf$[A],`x$0₃`.productElement(1).$asInstanceOf$[Long],`x$0₃`.productElement(2).$asInstanceOf$[LongMap[Deferred[F,Tuple2[A,Long]]]]) } toFunctorOps[F,Tuple2[Ref[F,State],Ref[F,Long]]](catsSyntaxSemigroupal[F,Ref[F,State]](F.ref[State](State.apply(initial,0L,LongMap.empty[Deferred[F,Tuple2[A,Long]]])))(F).product[Ref[F,Long]](F.ref[Long](1L)))(F).map[SignallingRef[F,A]](((x$1:Tuple2[Ref[F,State],Ref[F,Long]])=>x$1match{ caseTuple2(state,ids)=> defnewId:F[Long]=ids.getAndUpdate(((_$13:Long)=>_$13.+(1))) defupdateAndNotify[B](state:State,f:Function1[A,Tuple2[A,B]]):Tuple2[State,F[B]]={ val$2$:Tuple2[A,B]=(f.apply(state.value):@unchecked)match{ caseTuple2(newValue,result)=> Tuple2.apply[A,B](newValue,result) } val`newValue₂`:A=$2$._1 val`result₂`:B=$2$._2 val`lastUpdate₂`:Long=state.lastUpdate.+(1) valnewState:State=State.apply(`newValue₂`,`lastUpdate₂`,LongMap.empty[Deferred[F,Tuple2[A,Long]]]) valnotifyListeners:F[Unit]=toFoldableOps[Vector,Deferred[F,Tuple2[A,Long]]](state.listeners.values.toVector)(catsTraverseForVector).traverse_[F,Boolean](((listener:Deferred[F,Tuple2[A,Long]])=>listener.complete(ArrowAssoc[A](`newValue₂`).->[Long](`lastUpdate₂`))))(F) ArrowAssoc[State](newState).->[F[B]](toFunctorOps[F,Unit](notifyListeners)(F).as[B](`result₂`)) } { finalclass$anon()extendsSignallingRef[F,A]{ defget:F[A]=toFunctorOps[F,State](`state₂`.get)(F).map[A](((_$14:State)=>_$14.value)) defcontinuous:Stream[F,A]=Stream.repeatEval[F,A]($anon.this.get) defdiscrete:Stream[F,A]=Stream.resource[F,Tuple2[A,Stream[F,A]]]($anon.this.getAndDiscreteUpdates(F))(F).flatMap[F,A](((`x$1₂`:Tuple2[A,Stream[F,A]])=>`x$1₂`match{ caseTuple2(a,updates)=> Stream.emit[[x>:Nothing<:Any]=>Pure[x],A](a).++[F,A](updates) }))(value) overridedefgetAndDiscreteUpdates(implicitev:Concurrent[F]):Resource[F,Tuple2[A,Stream[F,A]]]=$anon.this.getAndDiscreteUpdatesImpl defgetAndDiscreteUpdatesImpl:Resource[F,Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]]={ defgo(id:Long,lastSeen:Long):Stream[F,A]={ defgetNext:F[Tuple2[A,Long]]=catsSyntaxFlatten[F,Tuple2[A,Long]](toFlatMapOps[F,Deferred[F,Tuple2[A,Long]]](F.deferred[Tuple2[A,Long]])(F).flatMap[F[Tuple2[A,Long]]](((wait:Deferred[F,Tuple2[A,Long]])=>`state₂`.modify[F[Tuple2[A,Long]]](((`x$1₃`:State)=>`x$1₃`match{ casestate@State(value,lastUpdate,listeners)=> if(`lastUpdate₃`.!=(lastSeen))ArrowAssoc[State](`state₃`).->[F[Tuple2[A,Long]]](catsSyntaxApplicativeId[Tuple2[A,Long]](ArrowAssoc[A](`value₂`).->[Long](`lastUpdate₃`)).pure[F](F))elseArrowAssoc[State]({ vallisteners$1:LongMap[Deferred[F,Tuple2[A,Long]]]=`listeners₂`.+[Deferred[F,Tuple2[A,Long]]](ArrowAssoc[Long](id).->[Deferred[F,Tuple2[A,Long]]](wait)) valvalue$1:A@uncheckedVariance=`state₃`.copy$default$1 vallastUpdate$1:Long@uncheckedVariance=`state₃`.copy$default$2 `state₃`.copy(value$1,lastUpdate$1,listeners=listeners$1) }).->[F[Tuple2[A,Long]]](wait.get) })))))(F).flatten(F) Stream.eval[F,Tuple2[A,Long]](getNext).flatMap[F,A](((`x$1₄`:Tuple2[A,Long])=>`x$1₄`match{ caseTuple2(a,lastUpdate)=> Stream.emit[[x>:Nothing<:Any]=>Pure[x],A](`a₂`).++[F,A](go(id,lastSeen=`lastUpdate₄`)) }))(value) } defcleanup(`id₂`:Long):F[Unit]=`state₂`.update(((s:State)=>{ vallisteners$2:LongMap[Deferred[F,Tuple2[A,Long]]]=s.listeners.-(`id₂`) valvalue$2:A@uncheckedVariance=s.copy$default$1 vallastUpdate$2:Long@uncheckedVariance=s.copy$default$2 s.copy(value$2,lastUpdate$2,listeners=listeners$2) })) Resource.eval[F,Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]](toFunctorOps[F,State](`state₂`.get)(F).map[Tuple2[A,Stream[[x>:Nothing<:Any]=>F[x],A]]](((`s₂`:State)=>Tuple2.apply[A,Stream[[x>:Nothing<:Any]=>F[x],A]](`s₂`.value,Stream.bracket[F,Long](newId)(((`id₃`:Long)=>cleanup(`id₃`))).flatMap[[x>:Nothing<:Any]=>F[x],A](((_$15:Long)=>go(_$15,`s₂`.lastUpdate)))(value))))) } defset(`a₃`:A):F[Unit]=$anon.this.update(((_$16:A)=>`a₃`)) defupdate(`f₂`:Function1[A,A]):F[Unit]=$anon.this.modify[Unit](((`a₄`:A)=>Tuple2.apply[A,Unit](`f₂`.apply(`a₄`),()))) defmodify[B](`f₃`:Function1[A,Tuple2[A,B]]):F[B]=`state₂`.flatModify[B](((_$17:State)=>updateAndNotify[B](_$17,`f₃`)))(F) deftryModify[B](`f₄`:Function1[A,Tuple2[A,B]]):F[Option[B]]=monadCancelOps_[F,Option[B]](toFlatMapOps[F,Option[F[B]]](`state₂`.tryModify[F[B]](((_$18:State)=>updateAndNotify[B](_$18,`f₄`))))(F).flatMap[Option[B]](((_$19:Option[F[B]])=>toTraverseOps[Option,F[B]](_$19)(catsTraverseForOption).sequence[F,B](refl[F[B]],F)))).uncancelable(F) deftryUpdate(`f₅`:Function1[A,A]):F[Boolean]=toFunctorOps[F,Option[Unit]]($anon.this.tryModify[Unit](((`a₅`:A)=>Tuple2.apply[A,Unit](`f₅`.apply(`a₅`),()))))(F).map[Boolean](((_$20:Option[Unit])=>_$20.isDefined)) defaccess:F[Tuple2[A,Function1[A,F[Boolean]]]]=toFunctorOps[F,Tuple2[State,Function1[State,F[Boolean]]]](`state₂`.access)(F).map[Tuple2[A,Function1[A,F[Boolean]]]](((`x$1₅`:Tuple2[State,Function1[State,F[Boolean]]])=>`x$1₅`match{ caseTuple2(state,set)=> valsetter:Function1[A,F[Boolean]]=((`newValue₃`:A)=>{ val$3$:Tuple2[State,F[Unit]]=(updateAndNotify[Unit](`state₄`,((_$21:A)=>Tuple2.apply[A,Unit](`newValue₃`,()))):@unchecked)match{ caseTuple2(newState,notifyListeners)=> Tuple2.apply[State,F[Unit]](`newState₂`,`notifyListeners₂`) } val`newState₃`:State=$3$._1 val`notifyListeners₃`:F[Unit]=$3$._2 toFlatMapOps[F,Boolean](set.apply(`newState₃`))(F).flatTap[Unit](((succeeded:Boolean)=>catsSyntaxApplicativeByName[F,Unit](`notifyListeners₃`).whenA(succeeded)(F))) }) Tuple2.apply[A,Function1[A,F[Boolean]]](`state₄`.value,setter) })) deftryModifyState[B](`state₅`:cats.data.State[A,B]):F[Option[B]]={ val`f₆`:Function1[A,Eval[Tuple2[A,B]]]=`state₅`.runF.value $anon.this.tryModify[B](((`a₆`:A)=>`f₆`.apply(`a₆`).value)) } defmodifyState[B](`state₆`:cats.data.State[A,B]):F[B]={ val`f₇`:Function1[A,Eval[Tuple2[A,B]]]=`state₆`.runF.value $anon.this.modify[B](((`a₇`:A)=>`f₇`.apply(`a₇`).value)) } } (new$anon():SignallingRef[F,A]) } })) }" t="n"class="documentableName ">of[F[_], A](initial: A)(implicit F: Concurrent[F]): F[SignallingRef[F, A]]

Builds a SignallingRef for for effect F, initialized to the supplied value.

Builds a SignallingRef for for effect F, initialized to the supplied value.

Attributes

Source
Signal.scala

Implicits

Implicits

implicit def invariantInstance[F[_] : Functor]: Invariant[[_] =>> SignallingRef[F, _$28]]

Attributes

Source
Signal.scala