Panic module.

This commit is contained in:
Stephen Diehl
2016-06-08 19:32:03 -04:00
parent 1e690a9e78
commit 6df421ad72
4 changed files with 22 additions and 5 deletions
+17
View File
@@ -0,0 +1,17 @@
module Panic (
FatalError(..),
panic,
) where
import Base (Show)
import Data.Text(Text)
import Control.Exception as X
-- | Uncatchable exceptions thrown and never caught.
data FatalError = FatalError { msg :: Text }
deriving (Show)
instance Exception FatalError
panic :: Text -> a
panic a = throw (FatalError a)