Skip to content
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

Extending mkYesodSubData #1365

jprider63 opened this Issue Mar 24, 2017 · 1 comment


None yet
1 participant
Copy link

jprider63 commented Mar 24, 2017

For background, please see this post on the google group. To solve the type variable not being in scope problem, I've deviated from my original plan of using a &{} syntax. Instead I've:

  • Updated mkYesodGeneral so that it can accept type variables as well. For example, you can now do: mkYesodSubData "MySubsite master". This also fixed a non-exhaustive pattern matching bug.
  • Updated ttToType so that type variables can be parsed in routes. This now can look something like: /#{MyDataId master} MyHandlerR GET
  • Added contexts as an argument to mkYesodGeneral'. These contexts are added to the instances generated. When there are contexts, I switched to use standalone deriving instead of regular deriving since I was running into this issue.

So far, it seems like everything is working as I'd like. You can see what I currently have on my vars branch. I don't think there are any breaking changes (I'm not sure if every template-haskell version works properly though).

I'd like to make a few more changes.

  • Implement a context parser so that we can just write mkYesodSubData "(MyClass master) => MySubsite master" instead of passing in a manually constructed Cxt.
  • Change the [Either String [String]] to [String] in mkYesodGeneral since the context parser would subsume this functionality.

Do you have any thoughts before I continue?


This comment has been minimized.

Copy link
Contributor Author

jprider63 commented Mar 27, 2017

I just created PR #1366. This implements the context parser and everything mentioned above it. There shouldn't be any breaking changes.

I didn't change mkYesodGeneral since this would be a breaking change with mkYesodWith exported. I can create a separate pull request if you'd like to save this change for the next major version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.