3 ms·
Is it? I've used Scala before. There are some cases, like compilers where I could see matching and extracting complex and nested patterns to be useful. But i
by paulddraper 8y ago
Is it?
I've used Scala before.
There are some cases, like compilers where I could see matching and extracting complex and nested patterns to be useful.
But in most cases monadic operations/functors plus if/else seems pretty much as good.
- mruts 8y agoUnfortunately monads aren’t in base scala (as an explicit class at least), so often you need to do some ad-hoc pattern matching on tuples or data structures and pattern matching really helps in de-structuring and binding relevant variables. I probably use monadic operations (map, fold, etc) at least 5-10 times a day in my job (I’m a scala dev), and match expressions at least 3-5 times a day. So pretty useful I’d say. Though then again I’m dealing with some pretty baroque case classes that contain dozens of values of financial information.
- paulddraper 8y ago> Unfortunately monads aren’t in base scala (as an explicit class at least) Scalaz and cats are perhaps the most common dependencies in the Scala ecosystem.