-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Scrap Your Reprinter -- -- A datatype generic algorithm for layout-preserving refactoring @package reprinter @version 0.1.0.0 module Text.Reprinter -- | The reprint algorithm takes a refactoring (parameteric in | some monad -- m) and turns an arbitrary pretty-printable type p | into a -- monadic Source transformer. reprint :: (Monad m, Data p) => Reprinting m -> p -> Source -> m Source -- | Given a lower-bound and upper-bound pair of Positions, split the | -- incoming Source based on the distanceF between the Position pairs splitBySpan :: (Position, Position) -> Source -> (Source, Source) data Position Position :: Int -> Int -> Position [posColumn] :: Position -> Int [posLine] :: Position -> Int type Source = ByteString type Reprinting m = forall b. Typeable b => b -> m (Maybe (RefactorType, Source, (Position, Position))) initPosition :: Position -- | Catch all generic query catchAll :: Monad m => a -> m (Maybe b) -- | Essentially wraps the refactorable interface genReprinting :: (Monad m, Refactorable t, Typeable t) => (t -> m Source) -> t -> m (Maybe (RefactorType, Source, (Position, Position))) -- | Infrastructure for building the reprinter "plugins" class Refactorable t isRefactored :: Refactorable t => t -> Maybe RefactorType getSpan :: Refactorable t => t -> (Position, Position) -- | Specify a refactoring type data RefactorType Before :: RefactorType After :: RefactorType Replace :: RefactorType instance GHC.Show.Show Text.Reprinter.Position instance Data.Data.Data Text.Reprinter.Position