4 ms·
Flow-control macros often become plain functions in Haskell, thanks to a combination of lazy evaluation and monadic syntax. `while`, `for`, `or` etc are all jus
by audreyt 13y ago
Flow-control macros often become plain functions in Haskell, thanks to a combination of lazy evaluation and monadic syntax. `while`, `for`, `or` etc are all just regular functions.
That said, macros are still useful for embedding foreign language snippets as literals (e.g. XML). GHC's TemplateHaskell extension takes care of that use case; it also provides quasi-quotation facilities that turns Haskell snippets into syntax tree literals for heavy-duty metaprogramming.