I have an update function that adds an Answer
to a Question
Once the question has been updated with an answer, I'd like to send it to an outgoing port, while also updating my model.
port emitQuestion : Question -> Cmd msg
update msg model =
AnswerQuestion answer ->
case model.question of
Nothing ->
( model, Cmd.none)
Just question ->
let
updatedQuestion =
{ question | answer = Just answer }
in
( { model | question = updatedQuestion } , Cmd.none)
How could I pass updatedQuestion
to emitQuestion
in this scenario ?