logoalt Hacker News

Someonelast Tuesday at 6:22 PM0 repliesview on HN

I would simplify that to

  x = foo() ||| <error case>
  <happy case>
(With the specific symbol used in lieu of ||| to be decided)

That is shorter and keeps the happy path unindented, even if it has additional such constructs, for example

  x = foo() ||| return Error(err, “foo failed”)
  y = bar() ||| return Error(err, “bar failed”)