-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Scrap Your Boilerplate utilities for the GHC API.
--   
--   Scrap Your Boilerplate utilities for the GHC API.
@package ghc-syb-utils
@version 0.3.0.0


-- | <a>GHC.Syb.Utils</a> provides common utilities for the Ghc Api, either
--   based on Data/Typeable or for use with Data.Generics over Ghc Api
--   types.
module GHC.SYB.Utils

-- | Ghc Ast types tend to have undefined holes, to be filled by later
--   compiler phases. We tag Asts with their source, so that we can avoid
--   such holes based on who generated the Asts.
data Stage
Parser :: Stage
Renamer :: Stage
TypeChecker :: Stage

-- | Like <a>everything</a>, but avoid known potholes, based on the
--   <a>Stage</a> that generated the Ast.
everythingStaged :: Stage -> (r -> r -> r) -> r -> GenericQ r -> GenericQ r

-- | A variation of <a>everything</a>, using a 'GenericQ Bool' to skip
--   parts of the input <a>Data</a>. everythingBut :: GenericQ Bool -&gt;
--   (r -&gt; r -&gt; r) -&gt; r -&gt; GenericQ r -&gt; GenericQ r
--   everythingBut q k z f x | q x = z | otherwise = foldl k (f x) (gmapQ
--   (everythingBut q k z f) x)
everythingButStaged :: Stage -> (r -> r -> r) -> r -> GenericQ (r, Bool) -> GenericQ r

-- | Look up a subterm by means of a maybe-typed filter.
somethingStaged :: Stage -> Maybe u -> GenericQ (Maybe u) -> GenericQ (Maybe u)

-- | Apply a monadic transformation at least somewhere.
--   
--   The transformation is tried in a top-down manner and descends down if
--   it fails to apply at the root of the term. If the transformation fails
--   to apply anywhere within the the term, the whole operation fails.
somewhereStaged :: MonadPlus m => Stage -> GenericM m -> GenericM m

-- | Monadic variation on everywhere
everywhereMStaged :: Monad m => Stage -> GenericM m -> GenericM m
instance GHC.Show.Show GHC.SYB.Utils.Stage
instance GHC.Classes.Ord GHC.SYB.Utils.Stage
instance GHC.Classes.Eq GHC.SYB.Utils.Stage
