On Wednesday, March 29, 2017 at 4:41:36 PM UTC+1, Stein Setvik wrote: > > Would you consider adding an option for users to disable the camel-case > requirement for record properties in the compiler? > > Our use case: > We have a large legacy system we'd like to bring Elm into that uses pascal > case throughout (all database fields and all places they're referenced in > the backend and frontend). > > We are planning on updating to camel case; however, it will be a > complicated change and is ~9 months out. > > We'd like to look at Elm before then, but the camel case requirement is > creating a performance hit because we have to clone all objects and rename > all pascal cased properties before shipping them over ports to Elm. > > Example: > We migrated a results view for realtime search (Algolia) in a product > catalog. The result view updates in real-time with every keystroke, and the > JS transformation of the data before sending it to Elm is weighty enough to > delay and slow the rendering of the results in a noticeable way. > > Thoughts? >
Do you have some meta-data describing the data structure that you want to map into Elm? For example json-schema or Swagger or possibly even the database DDL if the tables map to the HTTP response bodies in a very 1:1 way? If you have this, you could invest in writing a code generator that automatically writes your Elm Encoder/Decoder logic for you. As others have noted you can specify different field names in the json from the Elm records and have the Elm Encoder/Decoder logic handle the conversion between pascal and camel case for you. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
