mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-29 06:37:03 +03:00
Generalize compileError into Quasi constraint.
This commit is contained in:
parent
28fe9efeb5
commit
a5dd1c86ed
@ -25,13 +25,12 @@ module Language.Haskell.TH.Lib.Extra (
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Language.Haskell.TH
|
import Language.Haskell.TH
|
||||||
(Ppr, ppr, Q, runQ, runIO,
|
(Ppr, ppr, Q, runQ,
|
||||||
Name, Dec, sigD, valD, TypeQ, varP, normalB,
|
Name, Dec, sigD, valD, TypeQ, varP, normalB,
|
||||||
ExpQ, litE, integerL)
|
ExpQ, litE, integerL)
|
||||||
import Language.Haskell.TH.PprLib (Doc)
|
import Language.Haskell.TH.PprLib (Doc)
|
||||||
import Language.Haskell.TH.Syntax (Quasi)
|
import Language.Haskell.TH.Syntax (Quasi)
|
||||||
|
|
||||||
|
|
||||||
{- $extraTemplateFunctions
|
{- $extraTemplateFunctions
|
||||||
Extra functions to generate haskell templates.
|
Extra functions to generate haskell templates.
|
||||||
-}
|
-}
|
||||||
@ -65,9 +64,10 @@ which generating haskell templates.
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
-- | Raise compile error from TH code.
|
-- | Raise compile error from TH code.
|
||||||
compileError :: String -> Q a
|
compileError :: Quasi m => String -> m a
|
||||||
compileError = runIO . compileErrorIO
|
compileError = runQ . fail
|
||||||
|
|
||||||
-- | 'IO' version of 'compileError'.
|
-- | 'IO' version of 'compileError'.
|
||||||
compileErrorIO :: String -> IO a
|
compileErrorIO :: String -> IO a
|
||||||
compileErrorIO = ioError . userError
|
compileErrorIO = compileError
|
||||||
|
{-# DEPRECATED compileErrorIO "Use compileError instead of this" #-}
|
||||||
|
Loading…
Reference in New Issue
Block a user