0
我有一個模型:更新功能結合型模式榆樹
type Model
= InitialScreen
| ErrorScreen Http.Error
| List NormalRegion
和更新功能:
update : Msg -> a -> (Model, Cmd msg)
update msg model =
case msg of
FetchFail e ->
(ErrorScreen e, Cmd.none)
ShowRegions dto ->
(GeographiesDecoder.toNormalRegions dto.regions dto.countries, Cmd.none)
HoverRegion r ->
(model, Cmd.none)
其中toNormalRegions是
toNormalRegions : List Region -> List Country -> List NormalRegion
編譯器上更新FN拋出錯誤:
The 1st and 2nd branches of this `case` produce different types of values. - The 1st branch has this type:
(Model, Cmd msg)
But the 2nd is:
(List NormalRegion, Cmd msg)
有沒有辦法將List轉換爲Model?
有關定義爲'列表NormalRegion'一個'型alias'什麼? – pietro909