[racket] How to either extend eval or write macros in #lazy?

From: Sean Kanaley (skanaley at gmail.com)
Date: Mon Jul 1 14:31:07 EDT 2013

I'm attempting to provide a package very soon with Haskell-like type 
classes initially including Monoid, Functor, and Foldable, however I've 
discovered the terrible bug that mappend is too strict when it expands 
into "or" or "and".

Is there a way to extend eval from within #lang racket such that the 
user can still use #lang racket while I secretly have an extended 
version?  I would then add a lazy-lambda construct without requiring the 
entire set of future racket programs written using this library to be 
lazy.  In other words, if eval was a superclass or interface available 
in #lang racket, someone calling (mappend ...) would get the closure of 
some sort to be applied by this generic eval that I would implement 
internally to handle the fact that it's not a regular lambda.  If not, 
then solution 2:

#lazy ... simply using #lazy causes a couple issues:

1. define is not defined at phase1, solved by (require (for-syntax 
racket/base) ...)

2. define-syntax not valid in expression context etc. ... not sure how 
to solve ... it looks like #lazy doesn't permit internal definitions, 
but then how does one make a macro in lazy racket?

Posted on the users mailing list.