úÎP´J`J      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHINone+23468:<=FKLM CheckedException adds a phantom type parameter l to  SomeException ThrowsL is a type level binary relationship used to model a list of exceptions.KThere is only one case in which the user must add further instances to ThrowsL. If your sets of exceptions are hierarchical then you need to teach   about the hierarchy.  Subtyping¨As there is no way to automatically infer the subcases of an exception, they have to be encoded manually mirroring the hierarchy defined in the defined G instances. For example, the following instance encodes that MyFileNotFoundException is a subexception of  MyIOException : @instance Throws MyFileNotFoundException (Caught MyIOException l) [ is not a transitive relation and every ancestor relation must be explicitly encoded. ÿ -- TopException -- | instance Throws MidException (Caught TopException l) -- | -- MidException instance Throws ChildException (Caught MidException l) -- | instance Throws ChildException (Caught TopException l) -- | -- ChildException Note that < is automatically an ancestor of every other exception type. ,A type level witness of a exception handler.J SomeExceptionk is at the top of the exception hierarchy . Capturing SomeException captures every possible exception KLJMN    KLJMNNone+23468:<=FKLMO6PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx ONone+23468:<=FKLMMonadZeroException is thrown by MonadPlus x FailException is thrown by Monad P/A monad of explicitly typed, checked exceptions-UncaughtException models unchecked exceptions+In order to declare an unchecked exception E#, all that is needed is to make e an instance of  instance UncaughtException E™Note that declaring an exception E as unchecked does not automatically turn its children unchecked too. This is a shortcoming of the current encoding.<A Monad Transformer for explicitly typed checked exceptions.0Run a computation explicitly handling exceptions!Run a safe computation"0Run a safe computation checking even unchecked ( ) exceptions#The throw primitive$+Rethrow an exception keeping the call trace&0Run a computation explicitly handling exceptions(Run a safe computation)+Run a computation checking even unchecked (UncaughtExceptions ) exceptions*)This function may be used as a value for w in Z- !"#$%&'()*+,-./0123456789:;<= !"#$%&'()*+- =!"<;:9876543#$%21&'()0/.-*+,) !"#$%&'()*+,-./0123456789:;<=None+23468:<=FKLM>The catch primitive?}Catch and exception and observe the stack trace. If on top of the IO monad, this will also capture asynchronous exceptions@·Sequence two computations discarding the result of the second one. If the first computation rises an exception, the second computation is run and then the exception is rethrown.A_Like finally, but performs the second computation only when the first one rises an exceptionCWCapture an exception e, wrap it, and rethrow. Keeps the original monadic call trace.>y?@ABacquire resourcerelease resource computationCz' !"#$%&'()*>?@ABC'&'()!" #$>?@ABC%*>y?@ABCzNone+23468:<=FKLMDThe catch primitiveE}Catch and exception and observe the stack trace. If on top of the IO monad, this will also capture asynchronous exceptionsF·Sequence two computations discarding the result of the second one. If the first computation rises an exception, the second computation is run and then the exception is rethrown.GžLike finally, but performs the second computation only when the first one rises an exception TODO asynchronous exceptions! This needs to be moved to MonadIWCapture an exception e, wrap it, and rethrow. Keeps the original monadic call trace.DEFGHacquire resourcerelease resource computationI{' !"#$%&'()*DEFGHI'&'()!" #$DEFGHI%*DEFGHI{None+23468:<=FKLM' !"#$%&'()*DEFGHI|         !""#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHEFGHIJKLMNOPOQOROSOTUVUWUXOYOZU[U\U]U^U_U`UaUbUcUdUeUfUgUhUiUjUkUlUmUnUoUpUqUrUsUtUuUvUwUxUyz{{|control-monad-exception-0.11.2Control.Monad.Exception.IOControl.Monad.Exception.CatchControl.Monad.Exception.PureControl.Monad.Exception.ThrowsControl.Monad.Exception.BaseControl.Monad.ExceptionbaseData.Typeable.InternalTypeable GHC.Exception SomeException fromException toException Exception Typeable1failure-0.2.0.3Control.FailurefailureFailureCheckedExceptioncheckedExceptionThrowsCaught MonadCatchcatchcatchWithSrcLocMonadZeroException FailExceptionEMUncaughtException ParanoidMode NoExceptions AnyExceptionEMTunEMT CallTracetryEMT tryEMTWithLoc runEMTGenrunEMTrunEMTParanoidthrowrethrowshowExceptionWithTracetryEM tryEMWithLocrunEM runEMParanoid mplusDefaultmapLeft $fMonadIOEMT$fExceptionMonadZeroException$fExceptionFailException$fAlternativeEMT$fMonadPlusEMT $fUncaughtExceptionSomeException$fThrowseNoExceptions $fMonadFixEMT $fMonadLocEMT$fMonadTransControlEMT$fMonadBaseControlbEMT$fMonadBasebEMT$fMonadTransEMT $fFailureeEMT$fApplicativeEMT $fMonadEMT $fFunctorEMT$fThrowseAnyExceptionfinally onExceptionbracket wrapException$fThrowseCaught$fShowCheckedException$fThrowsSomeExceptionCaught$fThrowseCaught0$fThrowseCaught1$fMonadCatcheIOIOGHC.Basefail>>=>>fmapreturn Control.MonadguardliftMjoinMonadFunctor MonadPlusmfilterapliftM5liftM4liftM3liftM2unlesswhen replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMvoidforever<=<>=>msumforM_forMfilterMmapM_mapM sequence_sequence=<<mplusmzerounwrap$fMonadCatcheEMTEMT