Skip to content

Commit

Permalink
Add SBVException handler to prover calls. Fixes #444.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Huffman committed Nov 21, 2019
1 parent a08a85a commit 5725d23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Cryptol/REPL/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,10 @@ showProverStats mprover stat = rPutStrLn msg
maybe "" (\p -> ", using " ++ show p) mprover ++ ")"

rethrowErrorCall :: REPL a -> REPL a
rethrowErrorCall m = REPL (\r -> unREPL m r `X.catch` handler)
rethrowErrorCall m = REPL (\r -> unREPL m r `X.catch` handler `X.catch` handler')
where
handler (X.ErrorCallWithLocation s _) = X.throwIO (SBVError s)
handler' e = X.throwIO (SBVException e)


-- | Console-specific version of 'proveSat'. Prints output to the
Expand Down
3 changes: 3 additions & 0 deletions src/Cryptol/REPL/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ import qualified Data.Map as Map
import qualified Data.Set as Set
import Text.Read (readMaybe)

import Data.SBV (SBVException)
import Data.SBV.Dynamic (sbvCheckSolverInstallation)

import Prelude ()
Expand Down Expand Up @@ -273,6 +274,7 @@ data REPLException
| TypeNotTestable T.Type
| EvalInParamModule [M.Name]
| SBVError String
| SBVException SBVException
deriving (Show,Typeable)

instance X.Exception REPLException
Expand Down Expand Up @@ -300,6 +302,7 @@ instance PP REPLException where
text "Expression depends on definitions from a parameterized module:"
$$ nest 2 (vcat (map pp xs))
SBVError s -> text "SBV error:" $$ text s
SBVException e -> text "SBV exception:" $$ text (show e)

-- | Raise an exception.
raise :: REPLException -> REPL a
Expand Down

0 comments on commit 5725d23

Please sign in to comment.