Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's already withDefault to make that concise, so you can do things like this:

  withDefault 0 (head listOfNumbers)
No need to pattern match every time. :)

Docs for withDefault: http://package.elm-lang.org/packages/elm-lang/core/1.0.0/May...



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: