-
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
[#17] Strip field name prefixes #20
[#17] Strip field name prefixes #20
Conversation
Resolves #17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
:set -XTypeApplications | ||
import Data.Proxy | ||
import GHC.Generics | ||
import qualified Data.Text as T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
could we make this a configuration option? it turns out to be inconvenient sometimes |
Could you please open an issue and give us a basic idea on how you'd like this to be configurable? customOptions = defaultOptions
{ fieldLabelModifier = map toUpper
}
instance ToJSON Coord where
toJSON = genericToJSON customOptions
toEncoding = genericToEncoding customOptions We can consider implementing it, but no guarantees about timeline. |
yes; bafflingly that's what i'm trying, but it seems overriding the options via the ( is that because the -- edit: my bad, i see now that that is obvious. yes, i'm just looking to have that function |
interactions between Elm instance and aeson's FromJSON and ToJSON instances are a bit weird and can brake things. See for instance #115 It all depends on how you're deriving the ToJSON and FromJSON. |
It won't be that easy. |
i got confused, the point is |
call me crazy @jhrcek but if that function is customisable, i think everything else would just follow through, no? what would go wrong? |
Not saying it's impossible, just that it would not just be matter of extracting field label modifier within To/FromJSON instances but probably larger change. |
do you want me to make a new issue for this? |
yes please open new issue for this. Also feel free to submit PR. We will still need to test it and review it and if it seems solid I don't see a reason why it would not get accepted. |
Resolves #17
I've checked in the
ghci
. Seems to work: