Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicativeError final example - raiseError ignored #4045

Closed
steve-e opened this issue Nov 17, 2021 · 0 comments · Fixed by #4046
Closed

ApplicativeError final example - raiseError ignored #4045

steve-e opened this issue Nov 17, 2021 · 0 comments · Fixed by #4046

Comments

@steve-e
Copy link
Contributor

steve-e commented Nov 17, 2021

The final example for ApplicativeError is wrong IMO. It calls raiseError but the result is ignored.

def getTemperatureFromByCoordinatesAlternate[F[_]](x: (Int, Int))(implicit me: MonadError[F, String]): F[Int] = {
  if (x._1 < 0 || x._2 < 0) me.raiseError("Invalid Coordinates")
  for { c <- getCityClosestToCoordinate[F](x)
        t <- getTemperatureByCity[F](c) } yield t
}

Discussed briefly on gitter. Its just missing an else statement. Will create a PR referencing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant