ref: 2219ea535f4a0fd0afd9000ba5c6918c6b276210 Carth/src/Macro.hs -rw-r--r-- 4.8 KiB
Add patterns & declaration of literals in macros

Example of a do-notation-like macro using the new features:

    (defmacro do (<-)
      (case (do-bind ma) ma)
      (case (do-bind (<- a ma) mbs ...)
            (do-bind (fun (a) (do do-bind mbs ...)) ma))
      (case (do-bind ma mbs ...)
            (do-bind (fun (_) (do do-bind mbs ...)) ma)))

which can be used like

    (do list/bind
        (<- i (list 1 2 3))
        (<- j (list 1 2 3))
        (if (< i j)
            (list/singleton [i j])
Include macro expansion trace in SrcPos. Better err msgs!

    POS1: Error:

    POS2: Note:
    In expansion of macro.
Add macro rules and ellipsis (...) macro operator
Add primitive, single pattern macros

E.g. `(defmacro (plus a b) (+ a b))`