Hacker News new | ask | show | jobs
by dwb 3631 days ago
You can do exactly the same kind of pattern matching in Haskell, but that's not at all the point of the article. It's equivalent to writing the conditional, it doesn't remove it.

    publish :: Bool -> IO ()
    publish True =
      unsafePreparePackage dryRunOptions >>
        putStrLn "Dry run completed, no errors."
    publish False = do
      pkg <- unsafePreparePackage defaultPublishOptions
      putStrLn (A.encode pkg)