unison icon indicating copy to clipboard operation
unison copied to clipboard

base.io.systemTime / systemTime.impl can't fail

Open stew opened this issue 3 years ago • 5 comments

These things should be assumed to never fail. Its a pain to have to handle the failure type that will never happen

stew avatar Aug 18 '22 18:08 stew

Even though systemTime is deprecated, this ticket still applies to now and realtime, right?

I'm guessing it's thought to be able to fail with a Haskell IO error just because it's in IO, but probably it can't actually fail. We probably shouldn't change the builtin at this point, but could it be handled in base? cc @runarorama

aryairani avatar Jun 19 '24 00:06 aryairani

looking through the IO.concurrent namespace in @unison/base, it appears we have inherited or implemented GHC's asynchronous exception mechanism. So, any Unison IO action can raise an exception, even if it never explicitly throws an exception.

mitchellwrosen avatar Jun 19 '24 01:06 mitchellwrosen

Async exceptions needn't (and shouldn't) appear as Exception, only IO, because catching them requires a special operation that isn't Exception.catch

SystemFw avatar Jun 19 '24 16:06 SystemFw

Ah, I see – which operation is that?

mitchellwrosen avatar Jun 19 '24 16:06 mitchellwrosen

which operation is that?

tryEval

ceedubs avatar Jun 20 '24 10:06 ceedubs