elm-codegen icon indicating copy to clipboard operation
elm-codegen copied to clipboard

Qualified types in same module

Open thomasin opened this issue 3 years ago • 0 comments

https://ellie-app.com/jBhFzgXWv64a1 Hi (: I am not sure if this is a bug/outside scope of this package/I am doing something wrong.

Given

myFile : Elm.File
myFile =
    Elm.file [ "MyFirstFile" ]
        [ Elm.declaration "eightyFour"
            (Elm.value
                { annotation = Just (Elm.Annotation.named [ "MyFirstFile" ] "Custom")
                , importFrom = [ "MyFirstFile" ]
                , name = "Custom"
                }
            )
        ]
myFile.contents == """module MyFirstFile exposing (..)

{-| -}

import MyFirstFile

eightyFour : MyFirstFile.Custom
eightyFour = MyFirstFile.Custom
"""

when I would want the type and expression to not be aliased, and MyFirstFile to not be imported. My use case would be building up expressions without needing to know when they are built which module they are going to be used in. At the moment I do this with elm-syntax by passing file metadata down through expression functions and comparing module directories, but it would be so neat if elm-codegen can do this.

Thank you (:

thomasin avatar Sep 12 '22 17:09 thomasin