Reputation: 53963
I'm new to Elm and I just came across this:
update : Msg -> Model -> (Model, Cmd Msg)
update msg model =
case msg of
UrlChange location ->
( { model | history = location :: model.history }
, Cmd.none
)
Could someone tell me what the double colon does in line 5?
Upvotes: 4
Views: 1549
Reputation: 4775
That's the cons operator. It adds an item to the front of a list.
1 :: [2,3] == [1,2,3]
1 :: [] == [1]
Documentation:
https://package.elm-lang.org/packages/elm/core/latest/List#::
Upvotes: 10