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

Safe Haskell | Safe
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 #

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

Eq SrcSpan # |
Methods (==) :: SrcSpan -> SrcSpan -> Bool # (/=) :: SrcSpan -> SrcSpan -> Bool #
Data SrcSpan # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan # toConstr :: SrcSpan -> Constr # dataTypeOf :: SrcSpan -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) # gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan #
Ord SrcSpan # |
Methods compare :: SrcSpan -> SrcSpan -> Ordering # (<) :: SrcSpan -> SrcSpan -> Bool # (<=) :: SrcSpan -> SrcSpan -> Bool # (>) :: SrcSpan -> SrcSpan -> Bool # (>=) :: SrcSpan -> SrcSpan -> Bool # max :: SrcSpan -> SrcSpan -> SrcSpan # min :: SrcSpan -> SrcSpan -> SrcSpan #
Read SrcSpan # |
Methods readsPrec :: Int -> ReadS SrcSpan # readList :: ReadS [SrcSpan] # readPrec :: ReadPrec SrcSpan # readListPrec :: ReadPrec [SrcSpan] #
Show SrcSpan # |
Methods showsPrec :: Int -> SrcSpan -> ShowS # show :: SrcSpan -> String # showList :: [SrcSpan] -> ShowS #

data RType #

Types of expressions which we are able to replace.

Constructors

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

Instances

Eq RType # |
Methods (==) :: RType -> RType -> Bool # (/=) :: RType -> RType -> Bool #
Data RType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RType -> c RType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RType # toConstr :: RType -> Constr # dataTypeOf :: RType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c RType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RType) # gmapT :: (forall b. Data b => b -> b) -> RType -> RType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RType -> r # gmapQ :: (forall d. Data d => d -> u) -> RType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> RType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> RType -> m RType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RType -> m RType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RType -> m RType #
Ord RType # |
Methods compare :: RType -> RType -> Ordering # (<) :: RType -> RType -> Bool # (<=) :: RType -> RType -> Bool # (>) :: RType -> RType -> Bool # (>=) :: RType -> RType -> Bool # max :: RType -> RType -> RType # min :: RType -> RType -> RType #
Read RType # |
Methods readsPrec :: Int -> ReadS RType # readList :: ReadS [RType] # readPrec :: ReadPrec RType # readListPrec :: ReadPrec [RType] #
Show RType # |
Methods showsPrec :: Int -> RType -> ShowS # show :: RType -> String # showList :: [RType] -> ShowS #

data Refactoring a #

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

Functor Refactoring # |
Methods fmap :: (a -> b) -> Refactoring a -> Refactoring b # (<$) :: a -> Refactoring b -> Refactoring a #
Eq a => Eq (Refactoring a) # |
Methods (==) :: Refactoring a -> Refactoring a -> Bool # (/=) :: Refactoring a -> Refactoring a -> Bool #
Data a => Data (Refactoring a) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Refactoring a -> c (Refactoring a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Refactoring a) # toConstr :: Refactoring a -> Constr # dataTypeOf :: Refactoring a -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Refactoring a)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Refactoring a)) # gmapT :: (forall b. Data b => b -> b) -> Refactoring a -> Refactoring a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Refactoring a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Refactoring a -> r # gmapQ :: (forall d. Data d => d -> u) -> Refactoring a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Refactoring a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Refactoring a -> m (Refactoring a) #
Ord a => Ord (Refactoring a) # |
Methods compare :: Refactoring a -> Refactoring a -> Ordering # (<) :: Refactoring a -> Refactoring a -> Bool # (<=) :: Refactoring a -> Refactoring a -> Bool # (>) :: Refactoring a -> Refactoring a -> Bool # (>=) :: Refactoring a -> Refactoring a -> Bool # max :: Refactoring a -> Refactoring a -> Refactoring a # min :: Refactoring a -> Refactoring a -> Refactoring a #
Read a => Read (Refactoring a) # |
Methods readsPrec :: Int -> ReadS (Refactoring a) # readList :: ReadS [Refactoring a] # readPrec :: ReadPrec (Refactoring a) # readListPrec :: ReadPrec [Refactoring a] #
Show a => Show (Refactoring a) # |
Methods showsPrec :: Int -> Refactoring a -> ShowS # show :: Refactoring a -> String # showList :: [Refactoring a] -> ShowS #