Responses are therefore represented as a stack of monads:
type Response[A] = Future[Either[String, A]]
and methods getPowerLevel and canSpecialMove both return Response.
However, the solution redefines the Response[A] type:
type Response[A] = EitherT[Future, String, A]
This is very misleading. Using the Response shown in the problem description, there's no monad stack involved, and it is difficult to understand what the exercise wants.
IMO, it'll be clearer if the Response type definition is left as an exercise for students, with the requirement that the stack is of type Future[Either[String, *]].
The problem description states:
and methods
getPowerLevel
andcanSpecialMove
both returnResponse
.However, the solution redefines the
Response[A]
type:This is very misleading. Using the
Response
shown in the problem description, there's no monad stack involved, and it is difficult to understand what the exercise wants.IMO, it'll be clearer if the
Response
type definition is left as an exercise for students, with the requirement that the stack is of typeFuture[Either[String, *]]
.