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