GHCChoice.hs 566 B

1234567891011121314151617181920212223242526
  1. {-# LANGUAGE ScopedTypeVariables #-}
  2. module GHCChoice where
  3. import Control.Exception
  4. import CoreMonad
  5. import Exception
  6. import GHC
  7. ----------------------------------------------------------------
  8. (||>) :: Ghc a -> Ghc a -> Ghc a
  9. x ||> y = x `gcatch` (\(_ :: IOException) -> y)
  10. ----------------------------------------------------------------
  11. {-| Go to the next 'Ghc' monad by throwing 'AltGhcgoNext'.
  12. -}
  13. goNext :: Ghc a
  14. goNext = liftIO . throwIO $ userError "goNext"
  15. {-| Run any one 'Ghc' monad.
  16. -}
  17. runAnyOne :: [Ghc a] -> Ghc a
  18. runAnyOne = foldr (||>) goNext