I’m having a type mismatch error. Now I know that this is because the type signutares are mismatched, but if I change the message type, then it causes the same errors all the way down to my main program.
So my question is, in the column below, my Input.text
(elm-ui inputs) return my custom Settings.Msg
message as part of the onChange handler. How do I get around this limidation?
This is the Error:
-- TYPE MISMATCH -------- /home/andre/dev/cazinc/freeman/assets/src/Settings.elm
Something is off with the body of the `view` definition:
84|> column
85|> UI.frameBase
86|> -- [ el [] <| text model.auth_id
87|> -- , el [] <| text model.auth_secret
88|> -- , el [] <| text model.refresh_token
89|> -- ]
90|> [ Input.text
91|> []
92|> { label = Input.labelLeft [ centerY ] <| text "Auth ID"
93|> , text = model.auth_id
94|> , onChange = AuthIdChanged
95|> , placeholder = Nothing
96|> }
97|> , Input.text
98|> []
99|> { label = Input.labelLeft [ centerY ] <| text "Auth Secret"
100|> , text = model.auth_secret
101|> , onChange = AuthSecretChanged
102|> , placeholder = Nothing
103|> }
104|> , Input.text
105|> []
106|> { label = Input.labelLeft [ centerY ] <| text "Refresh Token"
107|> , text = model.refresh_token
108|> , onChange = RefreshTokenChanged
109|> , placeholder = Nothing
110|> }
111|> , Input.button
112|> UI.buttonBase
113|> { onPress = Nothing
114|> , label = text "Save"
115|> }
116|> ]
This `column` call produces:
Element Msg
But the type annotation on `view` says it should be:
Element msg
-- Settings.elm
-- ...
view : Element msg
view =
let
model = tempData
in
column
UI.frameBase
-- [ el [] <| text model.auth_id
-- , el [] <| text model.auth_secret
-- , el [] <| text model.refresh_token
-- ]
[ Input.text
[]
{ label = Input.labelLeft [ centerY ] <| text "Auth ID"
, text = model.auth_id
, onChange = AuthIdChanged
, placeholder = Nothing
}
, Input.text
[]
{ label = Input.labelLeft [ centerY ] <| text "Auth Secret"
, text = model.auth_secret
, onChange = AuthSecretChanged
, placeholder = Nothing
}
, Input.text
[]
{ label = Input.labelLeft [ centerY ] <| text "Refresh Token"
, text = model.refresh_token
, onChange = RefreshTokenChanged
, placeholder = Nothing
}
, Input.button
UI.buttonBase
{ onPress = Nothing
, label = text "Save"
}
]
-- ...
-- AppLayout.elm
-- ...
-- Main Content
contentPanel : Element msg
contentPanel =
column
[ width fill
, height fill
, centerX
]
[ Settings.view ]
-- Build the App layout
main : Html msg
main =
layout
[ Background.color Theme.color.gray0
, Font.color Theme.color.gray8
, Font.size 16
]
<| row
[ width fill, height fill ]
[ sidePanel
, contentPanel
]