Last active
May 31, 2018 11:17
-
-
Save bijancn/29e4d76c3987f5713a430ebf6f7948fc to your computer and use it in GitHub Desktop.
This file contains 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 loadNumberOfItems(url: String): IO[Either[Exception, Int]] = | |
Url(url) | |
.toRight(InvalidUrl) | |
.map(request(_)) | |
.traverse(_.map(_.getFieldOption("number").flatMap(_.as[Int]).toRight(InvalidJson))) | |
.map(_.flatten) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment