9
9
-}
10
10
module Kore.Repl (
11
11
runRepl ,
12
+ someExceptionHandler ,
13
+ withConfigurationHandler
12
14
) where
13
15
14
16
import Control.Concurrent.MVar
@@ -260,28 +262,16 @@ runRepl
260
262
if Graph. outdeg (Strategy. graph graph) node == 0
261
263
then
262
264
proveClaimStep claims axioms graph node
263
- & Exception. handle (withConfigurationHandler graph)
264
- & Exception. handle (someExceptionHandler graph)
265
+ & Exception. handle (withConfigurationHandler' graph)
266
+ & Exception. handle (someExceptionHandler' graph)
265
267
else pure graph
266
268
267
- withConfigurationHandler :: a -> Claim. WithConfiguration -> m a
268
- withConfigurationHandler
269
- _
270
- (Claim. WithConfiguration lastConfiguration someException)
271
- = do
272
- liftIO $
273
- hPutStrLn
274
- stderr
275
- (" // Last configuration:\n " <> unparseToString lastConfiguration)
276
- Exception. throwM someException
269
+ withConfigurationHandler' :: a -> Claim. WithConfiguration -> m a
270
+ withConfigurationHandler' _ = withConfigurationHandler
277
271
278
- someExceptionHandler :: a -> Exception. SomeException -> m a
279
- someExceptionHandler a someException = do
280
- case Exception. fromException someException of
281
- Just (Log. SomeEntry entry) ->
282
- Log. logEntry entry
283
- Nothing ->
284
- errorException someException
272
+ someExceptionHandler' :: a -> Exception. SomeException -> m a
273
+ someExceptionHandler' a someException = do
274
+ someExceptionHandler someException
285
275
pure a
286
276
287
277
replGreeting :: m ()
@@ -296,3 +286,27 @@ runRepl
296
286
putStr $ " Kore (" <> show (unReplNode node) <> " )> "
297
287
hFlush stdout
298
288
getLine
289
+
290
+ someExceptionHandler
291
+ :: MonadIO m
292
+ => Log. MonadLog m
293
+ => Exception. MonadThrow m
294
+ => Exception. SomeException -> m a
295
+ someExceptionHandler someException = do
296
+ case Exception. fromException someException of
297
+ Just (Log. SomeEntry entry) -> Log. logEntry entry
298
+ Nothing -> errorException someException
299
+ Exception. throwM someException
300
+
301
+ withConfigurationHandler
302
+ :: MonadIO m
303
+ => Exception. MonadThrow m
304
+ => Claim. WithConfiguration -> m a
305
+ withConfigurationHandler
306
+ (Claim. WithConfiguration lastConfiguration someException) =
307
+ do
308
+ liftIO $
309
+ hPutStrLn
310
+ stderr
311
+ (" // Last configuration:\n " <> unparseToString lastConfiguration)
312
+ Exception. throwM someException
0 commit comments