Append Maybe to List in Elm

Viewed 1059

I have a List a and a Maybe a. I want to append the maybe value if it is Just a but do nothing if it is Nothing.

This is what I am currently using:

aList ++ case maybeValue of
           Just value ->
             [ value ]
           Nothing ->
             []

Is there a better (more idiomatic) way of doing this?

Note that prepending is fine too if there is a cleaner way of doing that instead. The list order does not matter.

3 Answers
Related