3 ms·
case health <= 0 of False => pure () True => Output $ Death target This ought to just be: when (health <= 0) Output $ Death target It takes years
by lmm 7y ago
case health <= 0 of
False => pure ()
True => Output $ Death target
This ought to just be:
when (health <= 0) Output $ Death target
It takes years to learn all the general-purpose helper functions in these languages (I'm still discovering new ones after 10 years of Scala), but they can help make code so much clearer. And since they're just plain functions rather than keywords or anything, a reader who doesn't know can just jump through to the definition, which is a one-liner: https://github.com/idris-lang/Idris-dev/blob/master/libs/prelude/Prelude/Applicative.idr#L51 https://github.com/idris-lang/Idris-dev/blob/master/libs/pre...