tag:blogger.com,1999:blog-8515489.post1881469885307415459..comments2019-10-05T01:20:17.271-06:00Comments on logji: A monad for failure-tolerant computations.Kris Nuttycombehttp://www.blogger.com/profile/06347383351250086727noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-8515489.post-19571605548984839522010-08-05T09:31:28.397-06:002010-08-05T09:31:28.397-06:00Yeah, it's Writer specialized to the monoid Op...Yeah, it's Writer specialized to the monoid Option[S] where S is a semigroup. But you could simplify your definition to allow any monoid, thus becoming exactly the writer monad.<br /><br />case class Attempt[E:Monoid, +A](err: E, val: A)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8515489.post-83511728909680083292010-07-30T07:36:39.380-06:002010-07-30T07:36:39.380-06:00Nice! Here a simpler example which I've come u...Nice! Here a simpler example which I've come up with:<br /><br />val s: Attempt[List[String], String] = Success("result: success")<br />val f1: Attempt[List[String], String] = Failure("fail 1"::Nil, "result: failure 1")<br />val f2: Attempt[List[String], String] = Failure("fail 2"::Nil, "result: failure 2")<br /> <br />val r = <br /> for {<br /> x <- s<br /> y <- f1<br /> z <- f2<br /> }<br /> yield (x, y, z)<br /> <br />println(r)<br /><br />This prints:<br /><br />Failure(List(fail 2, fail 1),(result: success,result: failure 1,result: failure 2))Unknownhttps://www.blogger.com/profile/13587552231095691885noreply@blogger.comtag:blogger.com,1999:blog-8515489.post-81909361608243633442010-07-29T23:49:34.937-06:002010-07-29T23:49:34.937-06:00Hey Kris,
Looks interesting! Could you please prov...Hey Kris,<br />Looks interesting! Could you please provide a example for dummies?<br />Thanks,<br />HeikoHeiko Seebergerhttps://www.blogger.com/profile/05107839410251890061noreply@blogger.comtag:blogger.com,1999:blog-8515489.post-40445153492209493252010-07-29T18:33:19.780-06:002010-07-29T18:33:19.780-06:00Hi, Tom. Validations isn't quite the same thin...Hi, Tom. Validations isn't quite the same thing; it's rather more similar to Either in that in the event of a failure, it doesn't retain both the error and a degraded result value.Kris Nuttycombehttps://www.blogger.com/profile/06347383351250086727noreply@blogger.comtag:blogger.com,1999:blog-8515489.post-35274925488330596272010-07-29T17:58:08.269-06:002010-07-29T17:58:08.269-06:00Hey Kris, scalaz's validations may be what you...Hey Kris, scalaz's validations may be what you're looking for here:<br /><br />http://github.com/scalaz/scalaz/blob/master/core/src/main/scala/scalaz/Validation.scalaTom Adamshttps://www.blogger.com/profile/16126053163040522576noreply@blogger.com