|
|
|
|
|
by loup-vaillant
5576 days ago
|
|
Imagine Haskell lacked an "if then else" expression. Then: my_if :: Bool -> a -> a -> a
my_if True ifTrue _ -> if_true
my_if False _ ifFalse -> ifFalse
Usage (those 2 lines are equivalent): my_if (x > 42) (foo x) (bar x)
if (x > 42) then foo x else bar x
That's the basis of what we call combinator libraries. Application syntax and infix operators, used wisely, actually feel like ad-hoc syntax. Combined with lazy evaluation, they makes fully fledged macro much, much less useful. |
|
I fully recognize Haskell can do a very useful subset of the features of real dynamic syntax. It's still a proper subset though.