-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow for customisation of the field names that are generated #129
Comments
Having the function in Settings is probably not a good idea, because settings are meant to be shared across multiple types potentially. We'd have to make this configurable on per-type basis. |
just a note from my side: I think with new record dot syntax this issue will become only more relevant since a need for current implicit prefix striping will become less relevant. Also I second @jhrcek's opinion on allowing configuration per type. That IMO at least should be the underlying philosophy. |
it's a hack, but to avoid extreme configuration doom, note that the function already depends on the type name, so you could always check that as a string |
( fwiw, for my use case i'm happy with a change for all types ) |
@silky please check this PR #131 and let us know if this change is sufficient for your purposes. I wanted to keep the old behavior (stripping type name prefix) so as not to break dozens of instances our codebase at work uses. Yet to provide way to override that default behavior in a way that is not too hacky or inconvenient. This screenshot from updated haddock tells you how you could use the new capability: |
The abovementioned PR was merged and released as part of 0.2.1.1 release. |
Following a conversation in #20 it would be convenient to be able to customise the field-name-generation rules when emitting elm code.
In particular, the main culprit is the places this function - https://github.com/Holmusk/elm-street/blob/master/src/Elm/Generic.hs#L291- is used.
If that function could instead live in the
Settings
- https://hackage.haskell.org/package/elm-street-0.2.0.0/docs/Elm-Generate.html#t:Settings - then we'd get to customise that :)The text was updated successfully, but these errors were encountered: