refact-0.3.0.2: Specify refactorings to perform with apply-refact

Safe Haskell | Safe-Inferred
Language | Haskell2010

Refact.Types

Synopsis

- data SrcSpan = SrcSpan {
  - startLine :: !Int
  - startCol :: !Int
  - endLine :: !Int
  - endCol :: !Int
  }
- data RType
  - = Expr
  - | Decl
  - | Type
  - | Pattern
  - | Stmt
  - | ModuleName
  - | Bind
  - | Match
  - | Import
- data Refactoring a
  - = Replace {
    - rtype :: RType
    - pos :: a
    - subts :: [(String, a)]
    - orig :: String
    }
  - | ModifyComment {
    - pos :: a
    - newComment :: String
    }
  - | InsertComment {
    - pos :: a
    - newComment :: String
    }
  - | Delete {
    - rtype :: RType
    - pos :: a
    }
  - | RemoveAsKeyword {
    - pos :: a
    }

# Documentation

data SrcSpan Source #

A generic SrcSpan, usually this is converted immediately to a native representation. (For example a GHC SrcSpan or a HSE SrcSpan)

Constructors

SrcSpan |

Fields

- startLine :: !Int
- startCol :: !Int
- endLine :: !Int
- endCol :: !Int

#### Instances

Instances details

Data SrcSpan Source # |

Instance details

Defined in Refact.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan Source #

toConstr :: SrcSpan -> Constr Source #

dataTypeOf :: SrcSpan -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) Source #

gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan Source #

Read SrcSpan Source # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS SrcSpan Source # readList :: ReadS [SrcSpan] Source # readPrec :: ReadPrec SrcSpan Source # readListPrec :: ReadPrec [SrcSpan] Source #
Show SrcSpan Source # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> SrcSpan -> ShowS Source # show :: SrcSpan -> String Source # showList :: [SrcSpan] -> ShowS Source #
Eq SrcSpan Source # |
Instance details Defined in Refact.Types Methods (==) :: SrcSpan -> SrcSpan -> Bool Source # (/=) :: SrcSpan -> SrcSpan -> Bool Source #
Ord SrcSpan Source # |
Instance details Defined in Refact.Types Methods compare :: SrcSpan -> SrcSpan -> Ordering Source # (<) :: SrcSpan -> SrcSpan -> Bool Source # (<=) :: SrcSpan -> SrcSpan -> Bool Source # (>) :: SrcSpan -> SrcSpan -> Bool Source # (>=) :: SrcSpan -> SrcSpan -> Bool Source # max :: SrcSpan -> SrcSpan -> SrcSpan Source # min :: SrcSpan -> SrcSpan -> SrcSpan Source #

data RType Source #

Types of expressions which we are able to replace.

Constructors

Expr |
Decl |
Type |
Pattern |
Stmt |
ModuleName |
Bind |
Match |
Import |

#### Instances

Instances details

Data RType Source # |

Instance details

Defined in Refact.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RType -> c RType Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RType Source #

toConstr :: RType -> Constr Source #

dataTypeOf :: RType -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RType) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RType) Source #

gmapT :: (forall b. Data b => b -> b) -> RType -> RType Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RType -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RType -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RType -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RType -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RType -> m RType Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RType -> m RType Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RType -> m RType Source #

Read RType Source # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS RType Source # readList :: ReadS [RType] Source # readPrec :: ReadPrec RType Source # readListPrec :: ReadPrec [RType] Source #
Show RType Source # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> RType -> ShowS Source # show :: RType -> String Source # showList :: [RType] -> ShowS Source #
Eq RType Source # |
Instance details Defined in Refact.Types Methods (==) :: RType -> RType -> Bool Source # (/=) :: RType -> RType -> Bool Source #
Ord RType Source # |
Instance details Defined in Refact.Types Methods compare :: RType -> RType -> Ordering Source # (<) :: RType -> RType -> Bool Source # (<=) :: RType -> RType -> Bool Source # (>) :: RType -> RType -> Bool Source # (>=) :: RType -> RType -> Bool Source # max :: RType -> RType -> RType Source # min :: RType -> RType -> RType Source #

data Refactoring a Source #

Supported refactorings

Constructors

Replace |

Fields

- rtype :: RType

  Type of expression to be replaced

- pos :: a

  Expression to replace

- subts :: [(String, a)]

  Substitutions to make

- orig :: String

  Replacement template

ModifyComment |

Fields

- pos :: a

  Expression to replace

- newComment :: String

InsertComment |

Fields

- pos :: a

  Expression to replace

- newComment :: String

Delete |

Fields

- rtype :: RType

  Type of expression to be replaced

- pos :: a

  Expression to replace

RemoveAsKeyword | Takes the position of a import decl and removes the as keyword

Fields

- pos :: a

  Expression to replace

#### Instances

Instances details

Functor Refactoring Source # |
Instance details Defined in Refact.Types Methods fmap :: (a -> b) -> Refactoring a -> Refactoring b Source # (<$) :: a -> Refactoring b -> Refactoring a Source #
Data a => Data (Refactoring a) Source # |

Instance details

Defined in Refact.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Refactoring a -> c (Refactoring a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Refactoring a) Source #

toConstr :: Refactoring a -> Constr Source #

dataTypeOf :: Refactoring a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Refactoring a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Refactoring a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Refactoring a -> Refactoring a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Refactoring a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Refactoring a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Refactoring a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Refactoring a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) Source #

Read a => Read (Refactoring a) Source # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS (Refactoring a) Source # readList :: ReadS [Refactoring a] Source # readPrec :: ReadPrec (Refactoring a) Source # readListPrec :: ReadPrec [Refactoring a] Source #
Show a => Show (Refactoring a) Source # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> Refactoring a -> ShowS Source # show :: Refactoring a -> String Source # showList :: [Refactoring a] -> ShowS Source #
Eq a => Eq (Refactoring a) Source # |
Instance details Defined in Refact.Types Methods (==) :: Refactoring a -> Refactoring a -> Bool Source # (/=) :: Refactoring a -> Refactoring a -> Bool Source #
Ord a => Ord (Refactoring a) Source # |

Instance details

Defined in Refact.Types

Methods

compare :: Refactoring a -> Refactoring a -> Ordering Source #

(<) :: Refactoring a -> Refactoring a -> Bool Source #

(<=) :: Refactoring a -> Refactoring a -> Bool Source #

(>) :: Refactoring a -> Refactoring a -> Bool Source #

(>=) :: Refactoring a -> Refactoring a -> Bool Source #

max :: Refactoring a -> Refactoring a -> Refactoring a Source #

min :: Refactoring a -> Refactoring a -> Refactoring a Source #