Is it possible to use the ==constructor of tagged types of joins in Elm for comparison, or do you need to use a case?
Example:
type alias Model =
{ accessToken : String
, page : Page
, config : Config
}
type Page
= Home String
| Profile String
menu : Model -> Html Msg
menu model =
div []
[ a [ href "#home", classList [ ("active", model.page == Home) ] ][ text "Home" ]
, a [ href "#profile", classList [ ("active", model.page == Profile)] ][ text "Profile" ]
]
In this example, I would like to write something like model.page == Home to check if the current page is home, so that I can set the css class to “active” from this link, but it seems to me that I should use for this is a case that I can do, but kindly diligently implement this situation.
source
share