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

Generation of function names isn't namespace aware. #113

Open
turboMaCk opened this issue Feb 23, 2021 · 0 comments
Open

Generation of function names isn't namespace aware. #113

turboMaCk opened this issue Feb 23, 2021 · 0 comments

Comments

@turboMaCk
Copy link
Member

for code like (note the elmConstructFields):

newtype RichText =
    RichText Aeson.Value
    deriving stock (Show)
    deriving (FromJSON, ToJSON) via Aeson.Value


instance Elm RichText where
    toElmDefinition _ = DefType $
        ElmType
            { elmTypeName = "RichText"
            , elmTypeVars = []
            , elmTypeIsNewtype = False
            , elmTypeConstructors = ElmConstructor
                { elmConstructorName = "RichText"
                , elmConstructorFields = [ RefCustom $ TypeName "Json.Decode.Value" ]
                } :| []
            }

(and provided one can overcome #112 witch something like sed -e '/import Time exposing (Posix)/ a import Json.Decode' -i Generated/Types.elm)

elm street will generate decoder and encoding function like:

T.RichText x1 -> [("tag", E.string "RichText"), ("contents", encodeJson.Decode.Value x1)]

which is obviously not correct. Perhaps things like TypeName should contain qualified modules namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant