never executed always true always false
    1 -- | Metaprogramming types
    2 module GHC.Types.Meta
    3    ( MetaRequest(..)
    4    , MetaHook
    5    , MetaResult -- data constructors not exported to ensure correct response type
    6    , metaRequestE
    7    , metaRequestP
    8    , metaRequestT
    9    , metaRequestD
   10    , metaRequestAW
   11    )
   12 where
   13 
   14 import GHC.Prelude
   15 
   16 import GHC.Serialized   ( Serialized )
   17 
   18 import GHC.Hs
   19 
   20 
   21 -- | The supported metaprogramming result types
   22 data MetaRequest
   23   = MetaE  (LHsExpr GhcPs   -> MetaResult)
   24   | MetaP  (LPat GhcPs      -> MetaResult)
   25   | MetaT  (LHsType GhcPs   -> MetaResult)
   26   | MetaD  ([LHsDecl GhcPs] -> MetaResult)
   27   | MetaAW (Serialized     -> MetaResult)
   28 
   29 -- | data constructors not exported to ensure correct result type
   30 data MetaResult
   31   = MetaResE  { unMetaResE  :: LHsExpr GhcPs   }
   32   | MetaResP  { unMetaResP  :: LPat GhcPs      }
   33   | MetaResT  { unMetaResT  :: LHsType GhcPs   }
   34   | MetaResD  { unMetaResD  :: [LHsDecl GhcPs] }
   35   | MetaResAW { unMetaResAW :: Serialized      }
   36 
   37 type MetaHook f = MetaRequest -> LHsExpr GhcTc -> f MetaResult
   38 
   39 metaRequestE :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsExpr GhcPs)
   40 metaRequestE h = fmap unMetaResE . h (MetaE MetaResE)
   41 
   42 metaRequestP :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LPat GhcPs)
   43 metaRequestP h = fmap unMetaResP . h (MetaP MetaResP)
   44 
   45 metaRequestT :: Functor f => MetaHook f -> LHsExpr GhcTc -> f (LHsType GhcPs)
   46 metaRequestT h = fmap unMetaResT . h (MetaT MetaResT)
   47 
   48 metaRequestD :: Functor f => MetaHook f -> LHsExpr GhcTc -> f [LHsDecl GhcPs]
   49 metaRequestD h = fmap unMetaResD . h (MetaD MetaResD)
   50 
   51 metaRequestAW :: Functor f => MetaHook f -> LHsExpr GhcTc -> f Serialized
   52 metaRequestAW h = fmap unMetaResAW . h (MetaAW MetaResAW)
   53