While commenting on another question, I discovered an apparent break in referential transparency. In ghci:
> f g h = g `seq` h `seq` \x -> g (h x)
> seq (f undefined id) ()
()
> seq (undefined `seq` id `seq` \x -> undefined (id x)) ()
*** Exception: Prelude.undefined
CallStack (from HasCallStack):
error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err
undefined, called at <interactive>:3:14 in interactive:Ghci9
Why isn't the first one bottom? (GHC 8.2.2 in case it matters -- I don't have any other versions installed on this machine at the moment.)
An exception is a synchronous event that occurs during the execution of a thread that disrupts the normal flow of instructions. If exceptions are not properly processed during program execution, severe consequences, such as system failures, can occur.
11.1 The Causes of Exceptionsevaluation of an expression violates the normal semantics of the language, such as an integer divide by zero, as summarized in §15.6. an error occurs in loading or linking part of the program (§12.2, §12.3) some limitation on a resource is exceeded, such as using too much memory.
An exception handler handles a specific class can also handle its subclasses. If no exception handler is found in the call stack, the program terminates.
If an exception is raised in your program and that exception is not handled by an exception section in either the current or enclosing PL/SQL blocks, that exception is "unhandled." PL/SQL returns the error which raised an unhandled exception all the way back to the application environment from which PL/SQL was run.
Looks like this is Trac #14002. If you do a:
> :set -fpedantic-bottoms
or define f
in a file and load it into GHCi, then both expressions cause an exception.
The bug report claims it's difficult to fix without incurring a performance penalty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With