▲ | pansa2 8 days ago | |
> I would still use pattern matching for branching and destructing, but I’d put it in a helper Yeah, using a helper function makes things much clearer. To be honest though, I'm not a huge fan of using either `isinstance` (which is generally a sign of a bad design) nor `match/case` (which is essentially a "modern" way to write `isinstance`). I can't help but think that a better design could avoid the need for either of those (e.g. via polymorphism). | ||
▲ | the-grump 8 days ago | parent | next [-] | |
What I would use is an ADT and I make a wish for that every day in every language that’s not Haskell :D Haskell also has operator overloading on steroids so you could use the (|>) operator from Flow and write transformations the same as you would shell pipes. I’d love to whip up an example but it’s difficult on this tiny screen. Will try to remember when I’m on my computer. Before someone chimes in with ML propaganda, I warn you that I’m going to exercise my rights under the Castle Doctorine the moment you say “of”. | ||
▲ | davepeck 8 days ago | parent | prev [-] | |
You can access .strings and .interpolations directly and avoid type checks. There is always one more string than interpolation, of which there may be zero. |