haskell-servant / servant-elm

Automatically derive Elm functions to query servant webservices
BSD 3-Clause "New" or "Revised" License
164 stars 48 forks source link

Fix elmHeaderArg #29

Closed dharanii closed 7 years ago

dharanii commented 7 years ago

The argument name containing a hyphen will cause a syntax error in Elm.

e.g.

type BlahApi = "blah" :> Header "User-Agent" Text :> Get '[JSON] Blah

Before:

getBlah : String -> Http.Request (Blah)
getBlah header_User-Agent =
    Http.request
        { method =
            "GET"
        , headers =
            [ Http.header "User-Agent" header_User-Agent
            ]

After:

getBlah : String -> Http.Request (Blah)
getBlah header_User_Agent =
    Http.request
        { method =
            "GET"
        , headers =
            [ Http.header "User-Agent" header_User_Agent
            ]
mattjbray commented 7 years ago

Thanks!