just delete asInstanceOf (#259)

This commit is contained in:
Dima 2021-09-01 13:27:25 +03:00 committed by GitHub
parent 3e7b11db10
commit b0d76b9631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -34,7 +34,7 @@ class AbilitiesAlgebra[F[_], Alg[_]](implicit A: InjectK[AbilityOp[F, *], Alg])
def beginScope(token: Token[F]): Free[Alg, Unit] =
Free.liftInject[Alg](BeginScope[F](token))
def endScope(): Free[Alg, Boolean] =
def endScope(): Free[Alg, Unit] =
Free.liftInject[Alg](EndScope[F]())
}

View File

@ -24,7 +24,7 @@ class AbilitiesInterpreter[F[_], X](implicit
getState.map(_.abilities.get(name))
override def apply[A](fa: AbilityOp[F, A]): State[X, A] =
(fa match {
fa match {
case bs: BeginScope[F] =>
beginScope(AbilitiesState.Frame[F](bs.token))
@ -145,5 +145,5 @@ class AbilitiesInterpreter[F[_], X](implicit
).as(true)
}
}).asInstanceOf[State[X, A]]
}
}

View File

@ -27,4 +27,4 @@ case class GetServiceId[F[_]](name: Ability[F]) extends AbilityOp[F, Either[Bool
case class BeginScope[F[_]](token: Token[F]) extends AbilityOp[F, Unit]
case class EndScope[F[_]]() extends AbilityOp[F, Boolean]
case class EndScope[F[_]]() extends AbilityOp[F, Unit]

View File

@ -31,7 +31,7 @@ class NamesInterpreter[F[_], X](implicit lens: Lens[X, NamesState[F]], error: Re
}
override def apply[A](fa: NameOp[F, A]): State[X, A] =
(fa match {
fa match {
case rn: ReadName[F] =>
OptionT(constantDefined(rn.name.value))
.orElseF(readName(rn.name.value))
@ -107,5 +107,5 @@ class NamesInterpreter[F[_], X](implicit lens: Lens[X, NamesState[F]], error: Re
beginScope(NamesState.Frame(bs.token))
case _: EndScope[F] =>
endScope
}).asInstanceOf[State[X, A]]
}
}