Even pattern matching could be done with combinators. For lists, we could have a function matchList :: b -> (a -> [a] -> b) -> [a] -> b
such that f [] = foo; f (x:xs) = bar
would be equivalent to f = matchList foo (\x xs -> bar)
.
Inline recursion could be handled with fix
, possibly integrated into a special kind of lambda and/or combinators.
By "increased laziness" I mostly mean lazy integers with support for arithmetic, so you can do stuff like 2 * length x > length y
and have it work when x
is an infinite list. Another idea is that lists should have implicitly stored properties like "increasing", "cyclic", "finite" etc that builtins like filter
and elem
can take advantage of, so infinite lists are even more handy.
And for the syntax I feel like we have to go for infix expressions, with function application and/or composition as an "invisible" operator like in Haskell. Otherwise we'd need special syntax for higher order functions, which feels morally wrong. ;) Unless of course you have some ideas for that.