-- |
-- Module      :  Cryptol.Utils.Panic
-- Copyright   :  (c) 2013-2016 Galois, Inc.
-- License     :  BSD3
-- Maintainer  :  cryptol@galois.com
-- Stability   :  provisional
-- Portability :  portable

{-# LANGUAGE Trustworthy, TemplateHaskell #-}
module Cryptol.Utils.Panic
  (HasCallStack, CryptolPanic, Cryptol, Panic, panic, xxxTODO) where

import Panic hiding (panic)
import qualified Panic as Panic

data Cryptol = Cryptol

type CryptolPanic = Panic Cryptol

panic :: HasCallStack => String -> [String] -> a
panic :: forall a. HasCallStack => String -> [String] -> a
panic = forall a b.
(PanicComponent a, HasCallStack) =>
a -> String -> [String] -> b
Panic.panic Cryptol
Cryptol

xxxTODO :: HasCallStack => String -> a
xxxTODO :: forall a. HasCallStack => String -> a
xxxTODO String
x = forall a. HasCallStack => String -> [String] -> a
panic String
"TODO" [String
x]

instance PanicComponent Cryptol where
  panicComponentName :: Cryptol -> String
panicComponentName Cryptol
_ = String
"Cryptol"
  panicComponentIssues :: Cryptol -> String
panicComponentIssues Cryptol
_ = String
"https://github.com/GaloisInc/cryptol/issues"

  {-# Noinline panicComponentRevision #-}
  panicComponentRevision :: Cryptol -> (String, String)
panicComponentRevision = $Cryptol -> (String, String)
useGitRevision