clean up unused imports.
[hs-java.git] / JVM / Exceptions.hs
1 {-# LANGUAGE DeriveDataTypeable, ExistentialQuantification #-}
2 module JVM.Exceptions where
3
4 import Control.Monad.Exception
5
6 data NoItemInPool = forall a. Show a => NoItemInPool a
7   deriving (Typeable)
8
9 instance Exception NoItemInPool
10
11 instance Show NoItemInPool where
12   show (NoItemInPool s) = "Internal error: no such item in pool: <" ++ show s ++ ">"
13
14 force :: String -> EM AnyException a -> a
15 force s x =
16   case tryEM x of
17     Right result -> result
18     Left  exc    -> error $ "Exception at " ++ s ++ ": " ++ show exc