-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I'm using elm-codegen for the first time and found some inconsistent behavior. Let me know what you think!
Elm.filedoes not format the module name - so["My", "module"]would generate an invalid elm module.Elm.declarationdoes format the declaration name, but only by lowercasing the first letter.
Since both of these scenarios have some strict rules, maybe it would be worth to enforce them automatically?
An example solution using elmcraft/core-extra as dependency (for brevity sake):
toModulePart string =
String.Extra.classify string
toDeclarationName string =
let
classifiedString =
String.Extra.classify string
in
(String.toLower (String.left 1 classifiedString)) ++ (String.dropLeft 1 classifiedString)Note
- Since these rules are compiled enforced, I don't think there would be backwards compatibility problems, right? Anything else would be causing compile errors anyway. This would, at worst, automatically fix those.
- This could probably be applied to other scenarios that I haven't tried yet like type definitions.
Metadata
Metadata
Assignees
Labels
No labels