A good coding practice in Elm is to define the Model such that impossible states can not occur.
type alias ServerRequest =
{ Response (Maybe String)
, Failed (Maybe Error)
}
-- There can not be a Response and an Error at the same time.
type ServerRequest =
Waiting
Response String
Failed Error
In this section we will look at common ways how to avoid impossible states.