J'ai un modèle:mise à jour fonction union de type modèle orme
type Model
= InitialScreen
| ErrorScreen Http.Error
| List NormalRegion
et mise à jour fonction:
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)
où toNormalRegions est
toNormalRegions : List Region -> List Country -> List NormalRegion
compilateur throws erreur sur la mise à jour 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)
Existe-t-il un moyen de lancer la liste dans le modèle?
Qu'en est-il définir un 'type alias' pour la 'Liste NormalRegion'? – pietro909