News for hackers. Stuff that matters.
Re:Go Replaces Interface{} with 'Any' by eru on Tuesday December 14, 2021 @11:48PM (#29562221)
It sucks when you have to use it for everything, but it's a useful enough technique that most Haskell datatypes come with functions that provide exactly this conversion to church encoding.

See eg 'maybe' (https://www.stackage.org/haddock/lts-18.18/base-4.14.3.0/Pre... on stackage) or foldr for lists.

'foldr' is interesting, because it encapsulates a recursive pattern matching on lists. For the non-recursive version, see 'uncons' composed with 'maybe'.

Re:Go Replaces Interface{} with 'Any' by DarylZero on Wednesday December 15, 2021 @01:36AM (#29562806)
It's probably actually better than pattern matching when there are only two, as in those cases. But even at three, it becomes a mess. And more than three? Yuck.
Re:Go Replaces Interface{} with 'Any' by eru on Thursday December 16, 2021 @03:58AM (#29576382)
If your language does currying similar to Haskell, and there's a good order to your constructors / arguments, even with three or more there might be some benefits with partial application.