This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def choose(checkStatement: Int)(lstOfActions: List[(Int) => Unit]): Unit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def choose(checkStatment: Boolean)(ifTrue: => Unit, ifFalse: => Unit): Unit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def reduceSemigroup[A,B, F[_]](as:F[A])(f: A => B)(implicit F: Semigroup[B]): B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val fetchDB: IO[Unit] = IO{ | |
| // some side effect (fetch DB print something) | |
| fetchDB | |
| } | |
| val res = for { | |
| _ <- fetchingDB | |
| _ <- fetchingDB | |
| } yield () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val fetchingDB: Future[Unit] = Future{ | |
| // some side effect (fetch DB print something) | |
| fetchDB | |
| } | |
| for { | |
| _ <- fetchingDB | |
| _ <- fetchingDB | |
| } yield () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fetchAndParse(URL:String, client:Client): IO[Either[ParsingError,Json]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fetchAndParse(url:String, client:Client): Json = { | |
| val res = client.fetch(url) | |
| parse(res) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handlePrepare[V](msg: MessagePrepare[V]): State[Acceptor[V], Action] = | |
| for { | |
| acceptor <- State.get[Acceptor[V]] | |
| (newAcceptor, action) = acceptor.promiseId match { | |
| case Some(proposalId) if (msg.proposalId < proposalId) => (acceptor, Noop) | |
| case _ => | |
| ( | |
| acceptor.copy(promiseId = Some(msg.proposalId)), | |
| Send( | |
| MessagePromise(proposalId = msg.proposalId, acceptor.maybeAccepted) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait LearnerOps { | |
| def handleAccepted[V](msg: MessageAccepted[V]): State[Learner[V], Unit] | |
| def getValue[V]: State[Learner[V], Option[V]] | |
| } | |
| trait ProposerOps { | |
| def sendPrepareProposal[V](message: MessagePrepare[V]): Action | |
| def handlePromise[V](messages: List[MessagePromise[V]]): State[Proposer[V], Action] | |
| def handleAccept[V](messages: List[MessageAccepted[V]]): State[Proposer[V], Action] | |
| def constructHigherProposalId[V](prevProposal: Proposer[V]): Proposer[V] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def func(someArgument:SomeArgument): State[YourState, Action] |