
On Sat, 31 Oct 2020, Olaf Klinke wrote:
(Note: we can't just replace ToList with Foldable, because these classes have different kinds.)
- Any objections? An obvious concern is backwards compatibility. Is that a deal breaker? Are there other issues with this idea?
You would lose the pattern matching functionality, it seems. It reminds me very much of OverloadedStrings and that is not always as convenient as you might think. The issue is that a previously monomorphic piece of syntax suddenly is polymorphic, so in some places with OveroadedStrings one must provide type annotations. And that destroys the brevity one was after.
That's the problem. Instead of extending syntactic sugar you can resort to plain functional programming. Constructing a list: l :: [a] -> YourList a Use like: l[1,2,3]. Matching a list using continuation passing: withList :: ([a] -> b) -> YourList a -> b Use like in: func m = withList $ \(x:y:_) n -> ...