Fork me on GitHub
#off-topic
<
2017-01-22
>
beppu19:01:14

Paul Chiusano's book, Functional Programming in Scala is really good.

pesterhazy20:01:19

loved the credit card example

beppu20:01:57

@pesterhazy I'm only about 1/4th of the way through the book (so I haven't seen the credit card stuff yet), but an early big revelation for me was that exceptions weren't functional. The monadic error handling alternative was something I really wanted to know more about.

pesterhazy20:01:01

I've come to accept exceptions

pesterhazy20:01:09

they're actually not that bad

beppu20:01:10

@pesterhazy I went back to look for the credit card stuff, and I saw it was in the first chapter. I had totally forgotten about it!

pesterhazy20:01:48

I've tried using monads in clojure to return value-or-failure, but it's messy

beppu20:01:32

When I get a chance, I'm looking to give this library a spin for monadic error handling: https://github.com/adambard/failjure

pesterhazy20:01:45

that's what I used!

pesterhazy20:01:52

adam has a great blog post about that too

pesterhazy20:01:08

my use case wasn't right though

pesterhazy20:01:30

think credit card processor failure in an order process

pesterhazy20:01:41

exceptions are actually a good fit for that ๐Ÿ™‚

beppu20:01:33

I'm gonna have to play with it myself to convince myself one way or the other.

adambard21:01:35

I find myself using it for contained situations, but itโ€™s a bit inconvenient to thread through your entire application

adambard21:01:02

definitely not a replacement for exceptions

fellshard23:01:29

Exceptions are basically implicitly-wrapped Result-type returns

fellshard23:01:24

Java doesn't quite handle them that way - you can't lift an exception-throwing function into a Result-returning function reliably in Java, since you can't parameterize exception types for functions. But I'm guessing Scala might.