module Vulkan.Utils.Internal where
import Control.Monad.IO.Class
import GHC.IO ( throwIO )
import GHC.IO.Exception ( IOErrorType(..)
, IOException(..)
)
import System.IO ( hPutStrLn
, stderr
)
import Language.Haskell.TH.Quote
unsatisfiedConstraints :: String -> IO a
unsatisfiedConstraints :: String -> IO a
unsatisfiedConstraints message :: String
message =
IOException -> IO a
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO a) -> IOException -> IO a
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
UnsatisfiedConstraints "" String
message Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
noSuchThing :: String -> IO a
noSuchThing :: String -> IO a
noSuchThing message :: String
message =
IOException -> IO a
forall e a. Exception e => e -> IO a
throwIO (IOException -> IO a) -> IOException -> IO a
forall a b. (a -> b) -> a -> b
$ Maybe Handle
-> IOErrorType
-> String
-> String
-> Maybe CInt
-> Maybe String
-> IOException
IOError Maybe Handle
forall a. Maybe a
Nothing IOErrorType
NoSuchThing "" String
message Maybe CInt
forall a. Maybe a
Nothing Maybe String
forall a. Maybe a
Nothing
sayErr :: MonadIO m => String -> m ()
sayErr :: String -> m ()
sayErr = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> (String -> IO ()) -> String -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> String -> IO ()
hPutStrLn Handle
stderr
badQQ :: String -> QuasiQuoter
badQQ :: String -> QuasiQuoter
badQQ name :: String
name = (String -> Q Exp)
-> (String -> Q Pat)
-> (String -> Q Type)
-> (String -> Q [Dec])
-> QuasiQuoter
QuasiQuoter (String -> String -> Q Exp
forall a. String -> a
bad "expression")
(String -> String -> Q Pat
forall a. String -> a
bad "pattern")
(String -> String -> Q Type
forall a. String -> a
bad "type")
(String -> String -> Q [Dec]
forall a. String -> a
bad "declaration")
where
bad :: String -> a
bad :: String -> a
bad context :: String
context =
String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$ "Can't use " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
name String -> String -> String
forall a. Semigroup a => a -> a -> a
<> " quote in a " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
context String -> String -> String
forall a. Semigroup a => a -> a -> a
<> " context"