-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made inner loops have access to outer loop values #726
base: master
Are you sure you want to change the base?
Conversation
This looks good, thanks for the PR! Is it possible to update this with:
|
Sure |
Yeah, I thought about exporting it. I thought it wasn't useful enough. It sounds like a good idea. Now. I'm a little overwhelmed right now, will finish the pull request in a couple days. |
I guess for the API I would prefer a simple bindItem :: Context a -> Item a -> forall b. Context b
-- or
bindContext :: Item a -> Context a -> forall b. Context b (not sure which one is better?) over a three-parameter and non-descriptive You could then write ListField c xs -> do
sep <- maybe (return "") go s
bs <- mapM (applyTemplate' b $ c <> bindItem context x) xs
return $ intercalate sep bs |
If my outer loop in a template produces a value that I want to use in my inner loop, I get a
Missing field
error.This gives inner loops access to outer loop values and allows inner loops to override them.