[racket-users] As clean as possible in a dirty macro

2016-04-25 Thread Nicholas Labich
I'm trying to write a small monad transformer library with macros. My goal: (define-monad IdM [(return a) a] [(bind m f) (f m)] [(foo) 'id-foo]) (define-trans ListT [(return a) (returnₘ (list a))] [(bind m f) (bindₘ m (λ (loa) (foldl (λ (a m′) (returnₘ (append (f a)

Re: [racket-users] As clean as possible in a dirty macro

2016-04-26 Thread Alex Knauth
> On Apr 26, 2016, at 4:38 PM, Nicholas Labich wrote: > > Hmm, no takers on this wall of text? ;) > > Turns out I was looking in the wrong direction. While reading some of > Matthew's sets of scopes notes, I stumbled across an example with exactly the > tool I needed: `syntax-local-introduce'

Re: [racket-users] As clean as possible in a dirty macro

2016-04-27 Thread Alex Knauth
> On Apr 27, 2016, at 2:55 AM, Nicholas Labich wrote: > > Thanks for the feedback. Attached is the solution applied to my original > implementation (only 65loc, documented). A couple of interesting points: > > - My simplified example didn't show this, but I have to > `syntax-local-introduce'

Re: [racket-users] As clean as possible in a dirty macro

2016-04-27 Thread Nicholas Labich
On Wednesday, April 27, 2016 at 8:55:29 AM UTC-4, Alex Knauth wrote: > I'm not sure if this is what you wanted, but here's a version of your monad > file with much less weird macro stuff. It used syntax-local-introduce in two > places right next to each other, and it doesn't use datum->syntax, >