you can't pattern match on a function
-
This Tweet is unavailable.
-
-
Replying to @mattoflambda
that's good, pattern matching should be avoided!!
1 reply 0 retweets 5 likes -
Replying to @puffnfresh @mattoflambda
Care to elaborate more on this thought? I actually like pattern matching given that it is a pretty way of declaring conditions. I guess what you mean is that it is better to encode as many conditions into existing classes with properties? If so, pointers for this? :)
3 replies 0 retweets 1 like -
Replying to @NickSeagull @mattoflambda
use folds instead of pattern matching. Usually better because they're reusable functions.
2 replies 0 retweets 4 likes -
Is there a longer-than-280-character expansion somewhere of the why behind this?
1 reply 0 retweets 1 like -
Replying to @carlfish @puffnfresh and
well, for a start a fold/catamorphism is provided functions that handle each case individually, patterns may be partial, or conditional and have overlap, so order is important.
1 reply 0 retweets 3 likes -
but there's also https://typelevel.org/blog/2014/11/10/why_is_adt_pattern_matching_allowed.html … by
@S11001001 which touches on some of the issues, although not really being specifically about it1 reply 0 retweets 0 likes -
touches on a lot of Scala issues but nothing really about the lack of code reuse. I don't think there's many resources on this sadly. I should fix that
1 reply 0 retweets 5 likes -
Replying to @puffnfresh @jedws and
Indeed I wasn't talking about the "can't be bothered to glance at the available combinators" issue of programming practice at all,
@dibblego did that perfectly well already http://blog.tmorris.net/posts/scalaoption-cheat-sheet/ … . If readers can take the hint and generalize the point he's making1 reply 0 retweets 1 like
@NickSeagull
Why would you write this:
\x m ->
case m of
Nothing -> x
Just a -> a
when it is already done:
\x m ->
fromMaybe x m
Actually, the former is the source code to fromMaybe. Why repeat it?
(etc etc)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.