scala.util.Try

4
前へ 1 ・・ 4 5
marius eriksen @marius

@djspiewak ie. we could similarly say that impurity is part of Try's contract.

2012-08-29 09:16:06
marius eriksen @marius

@djspiewak (or am i missing something? — quite possible)

2012-08-29 09:16:31
Daniel Spiewak @djspiewak

@marius We can say that impurity is part of Try's contract, at which point it basically becomes an incarnation of the IO monad.

2012-08-29 09:17:13
Daniel Spiewak @djspiewak

@marius The weird bit is that Try is an incarnation of the IO monad where the failure state is eagerly testable, which is a bit…odd

2012-08-29 09:17:49
marius eriksen @marius

@mergeconflict btw, would *love* to see something (perhaps a blog post from you!) explaining Validation and how it differs from Try.

2012-08-29 09:18:37
mergeconflict @mergeconflict

@marius Not gonna blog, just say it differs mainly in that it doesn't handle "raw" exceptions. All it has for that is: https://t.co/lx5CV0vx

2012-08-29 09:26:59
marius eriksen @marius

@mergeconflict Got it. Yes, so it's basically just a specialized Either, then.

2012-08-29 09:28:38
mergeconflict @mergeconflict

@marius Yup. Another important difference is that it accumulates errors when possible (i.e. when used as Applicative): https://t.co/1vLkQygJ

2012-08-29 09:30:20
Paul Snively @psnively

try/catch around a block with a lazy val that can throw shall not avail you. #scala

2012-08-29 09:41:43
Josh Suereth @jsuereth

@djspiewak @rolandkuhn @marius I don't see the issue if you remove catching functions from "counting" in your category like side effecting

2012-08-29 09:50:29
Daniel Spiewak @djspiewak

@jsuereth @rolandkuhn @marius Catching functions are not referentially transparent as they cannot be beta reduced.

2012-08-29 10:11:11
Josh Suereth @jsuereth

@djspiewak @rolandkuhn @marius Right, so our category is now just functions that catch? I'm looking at monad laws now.

2012-08-29 10:13:26
Brian McKenna @puffnfresh

Hey #scalaz faction, stop trolling the #scala community with your fancy maths and laws.

2012-08-29 10:20:31
Josh Suereth @jsuereth

@dibblego @djspiewak @marius Ok, so the Monad law is violated if you allow throwing functions into your category.

2012-08-29 10:52:45
Josh Suereth @jsuereth

@dibblego @djspiewak @marius specifically left identity: f(x) == Try(x) flatMap f

2012-08-29 10:54:02
前へ 1 ・・ 4 5