Safe Haskell | None |
---|---|

Language | Haskell2010 |

- reprintSort :: (Monad m, Data ast) => Reprinting m -> ast -> Source -> m Source
- reprint :: (Monad m, Data ast) => Reprinting m -> ast -> Source -> m Source
- type Source = Text
- type Position = (Line, Col)
- initPosition :: Position
- initLine :: Line
- initCol :: Col
- mkLine :: Int -> Either String Line
- mkCol :: Int -> Either String Col
- advanceLine :: Position -> Position
- advanceCol :: Position -> Position
- type Span = (Position, Position)
- type Reprinting m = forall node. Typeable node => node -> m (Maybe (RefactorType, Source, Span))
- catchAll :: Monad m => a -> m (Maybe b)
- genReprinting :: (Monad m, Refactorable t, Typeable t) => (t -> m Source) -> t -> m (Maybe (RefactorType, Source, Span))
- class Refactorable t where
- data RefactorType

# Documentation

reprintSort :: (Monad m, Data ast) => Reprinting m -> ast -> Source -> m Source Source #

The reprint algorithm takes a refactoring (parameteric in
| some monad m) and turns an arbitrary pretty-printable type `ast`

| into a monadic Source transformer.

reprint :: (Monad m, Data ast) => Reprinting m -> ast -> Source -> m Source Source #

The reprint algorithm takes a refactoring (parameteric in
| some monad m) and turns an arbitrary pretty-printable type `ast`

| into a monadic Source transformer.

initPosition :: Position Source #

The initial position

advanceLine :: Position -> Position Source #

Given a position, go down a line, going back to the initial column

advanceCol :: Position -> Position Source #

Given a position, advance by one column

type Span = (Position, Position) Source #

Two positions give the lower and upper bounds of a source span

type Reprinting m = forall node. Typeable node => node -> m (Maybe (RefactorType, Source, Span)) Source #

Type of a reprinting function

genReprinting :: (Monad m, Refactorable t, Typeable t) => (t -> m Source) -> t -> m (Maybe (RefactorType, Source, Span)) Source #

Essentially wraps the refactorable interface

class Refactorable t where Source #

Infrastructure for building the reprinter "plugins"

isRefactored :: t -> Maybe RefactorType Source #