Skip to content

Instantly share code, notes, and snippets.

@halfzebra
Last active April 15, 2016 19:08
Show Gist options
  • Save halfzebra/657667763454d91353a6ac739c40c3cf to your computer and use it in GitHub Desktop.
Save halfzebra/657667763454d91353a6ac739c40c3cf to your computer and use it in GitHub Desktop.
Maybe.withDefault crashes every time, because it evaluates both branches first
import Graphics.Element exposing (show)
import Debug
import Maybe exposing (..)
main =
-- Maybe.withDefault crashes every time, because it evaluates both branches first, before passing them to case
-- https://github.com/elm-lang/core/blob/4.0.0/src/Maybe.elm#L51
show (withDefault (Debug.crash "Test") (Just 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment