evalCatchAERNExceptions :: String -> t -> Either AERNException t
evalCatchAERNExceptions contextDescription a =
    unsafePerformIO $ catch (evaluateEmbed a) handler
    where
    handler e@(AERNException msg) =
        do
        putStrLn $ "caught AERN exception: " ++ msg
        return (Left e)
    handler e@(AERNIllegalValue msg) =
        do 
        putStrLn $ "caught AERN illegal value exception: " ++ msg
        return (Left e)
    handler e@(AERNDomViolationException msg) =
        do 
        putStrLn $ "caught AERN operation domain violation exception: " ++ msg
        return (Left e)
    handler e@(AERNMaybeDomViolationException msg) =
        do 
        putStrLn $ "caught AERN potential operation domain violation exception: " ++ msg
        return (Left e)
    evaluateEmbed a =
        do
        aa <- evaluate a
        return $ Right aa
evalCatchAERNExceptions :: String -> t -> Either AERNException t
evalCatchAERNExceptions contextDescription a =
    unsafePerformIO $ catch (evaluateEmbed a) handler
    where
    handler e@(AERNException msg) =
        do
        putStrLn $ "caught AERN exception: " ++ msg
        return (Left e)
    handler e@(AERNIllegalValue msg) =
        do 
        putStrLn $ "caught AERN illegal value exception: " ++ msg
        return (Left e)
    handler e@(AERNDomViolationException msg) =
        do 
        putStrLn $ "caught AERN operation domain violation exception: " ++ msg
        return (Left e)
    handler e@(AERNMaybeDomViolationException msg) =
        do 
        putStrLn $ "caught AERN potential operation domain violation exception: " ++ msg
        return (Left e)
    evaluateEmbed a =
        do
        aa <- evaluate a
        return $ Right aa
evalCatchAERNExceptions contextDescription a =
    unsafePerformIO $ catch (evaluateEmbed a) handler
    where
    handler e@(AERNException msg) =
        do
        putStrLn $ "caught AERN exception: " ++ msg
        return (Left e)
    handler e@(AERNIllegalValue msg) =
        do 
        putStrLn $ "caught AERN illegal value exception: " ++ msg
        return (Left e)
    handler e@(AERNDomViolationException msg) =
        do 
        putStrLn $ "caught AERN operation domain violation exception: " ++ msg
        return (Left e)
    handler e@(AERNMaybeDomViolationException msg) =
        do 
        putStrLn $ "caught AERN potential operation domain violation exception: " ++ msg
        return (Left e)
    evaluateEmbed a =
        do
        aa <- evaluate a
        return $ Right aa