Safe Haskell | None |
---|---|
Language | Haskell98 |
This module contains routines used to perform generic traversals of the GHC AST, avoiding the traps resulting from certain fields being populated with values defined to trigger an error if ever evaluated.
This is a useful feature for tracking down bugs in GHC, but makes use of the GHC library problematic.
- everywhereM' :: Monad m => GenericM m -> GenericM m
- everywhereMStaged' :: Monad m => Stage -> GenericM m -> GenericM m
- everywhereStaged :: Stage -> (forall a. Data a => a -> a) -> forall a. Data a => a -> a
- everywhereStaged' :: Stage -> (forall a. Data a => a -> a) -> forall a. Data a => a -> a
- listifyStaged :: (Data a, Typeable a1) => Stage -> (a1 -> Bool) -> a -> [a1]
- zeverywhereStaged :: Typeable a => Stage -> GenericT -> Zipper a -> Zipper a
- zopenStaged :: Typeable a => Stage -> GenericQ Bool -> Zipper a -> [Zipper a]
- zsomewhereStaged :: MonadPlus m => Stage -> GenericM m -> Zipper a -> m (Zipper a)
- transZ :: Stage -> GenericQ Bool -> (Stage -> Zipper a -> Zipper a) -> Zipper a -> Zipper a
- transZM :: Monad m => Stage -> GenericQ Bool -> (Stage -> Zipper a -> m (Zipper a)) -> Zipper a -> m (Zipper a)
- zopenStaged' :: Typeable a => Stage -> GenericQ (Maybe b) -> Zipper a -> [(Zipper a, b)]
- ztransformStagedM :: (Typeable a, Monad m) => Stage -> GenericQ (Maybe (Stage -> Zipper a -> m (Zipper a))) -> Zipper a -> m (Zipper a)
- upUntil :: GenericQ Bool -> Zipper a -> Maybe (Zipper a)
- findAbove :: Data a => (a -> Bool) -> Zipper a -> Maybe a
SYB versions
everywhereMStaged' :: Monad m => Stage -> GenericM m -> GenericM m Source #
Monadic variation on everywhere'
everywhereStaged :: Stage -> (forall a. Data a => a -> a) -> forall a. Data a => a -> a Source #
Bottom-up transformation
everywhereStaged' :: Stage -> (forall a. Data a => a -> a) -> forall a. Data a => a -> a Source #
Top-down version of everywhereStaged
listifyStaged :: (Data a, Typeable a1) => Stage -> (a1 -> Bool) -> a -> [a1] Source #
Staged variation of SYB.listify The stage must be provided to avoid trying to modify elements which may not be present at all stages of AST processing.
SYB Utility
Scrap Your Zipper versions
zeverywhereStaged :: Typeable a => Stage -> GenericT -> Zipper a -> Zipper a Source #
Apply a generic transformation everywhere in a bottom-up manner.
zopenStaged :: Typeable a => Stage -> GenericQ Bool -> Zipper a -> [Zipper a] Source #
Open a zipper to the point where the Geneneric query passes. returns the original zipper if the query does not pass (check this)
zsomewhereStaged :: MonadPlus m => Stage -> GenericM m -> Zipper a -> m (Zipper a) Source #
Apply a generic monadic transformation once at the topmost leftmost successful location, avoiding holes in the GHC structures
transZ :: Stage -> GenericQ Bool -> (Stage -> Zipper a -> Zipper a) -> Zipper a -> Zipper a Source #
Transform a zipper opened with a given generic query
transZM :: Monad m => Stage -> GenericQ Bool -> (Stage -> Zipper a -> m (Zipper a)) -> Zipper a -> m (Zipper a) Source #
Monadic transform of a zipper opened with a given generic query
zopenStaged' :: Typeable a => Stage -> GenericQ (Maybe b) -> Zipper a -> [(Zipper a, b)] Source #
Open a zipper to the point where the Generic query passes, returning the zipper and a value from the specific part of the GenericQ that matched. This allows the components of the query to return a specific transformation routine, to apply to the returned zipper
ztransformStagedM :: (Typeable a, Monad m) => Stage -> GenericQ (Maybe (Stage -> Zipper a -> m (Zipper a))) -> Zipper a -> m (Zipper a) Source #
Open a zipper to the point where the Generic query passes, and apply the transformation returned from the specific part of the GenericQ that matched.