Refact.Types

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 #

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 # |
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 # 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 :: forall r r'. (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 #
Read SrcSpan # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS SrcSpan # readList :: ReadS [SrcSpan] # readPrec :: ReadPrec SrcSpan # readListPrec :: ReadPrec [SrcSpan] #
Show SrcSpan # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> SrcSpan -> ShowS # show :: SrcSpan -> String # showList :: [SrcSpan] -> ShowS #
Eq SrcSpan # |
Instance details Defined in Refact.Types Methods (==) :: SrcSpan -> SrcSpan -> Bool # (/=) :: SrcSpan -> SrcSpan -> Bool #
Ord SrcSpan # |
Instance details Defined in Refact.Types 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 #

data RType #

Types of expressions which we are able to replace.

Constructors

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

#### Instances

Instances details

Data RType # |
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 # 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 :: forall r r'. (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 #
Read RType # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS RType # readList :: ReadS [RType] # readPrec :: ReadPrec RType # readListPrec :: ReadPrec [RType] #
Show RType # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> RType -> ShowS # show :: RType -> String # showList :: [RType] -> ShowS #
Eq RType # |
Instance details Defined in Refact.Types Methods (==) :: RType -> RType -> Bool # (/=) :: RType -> RType -> Bool #
Ord RType # |
Instance details Defined in Refact.Types 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 #

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

Instances details

Functor Refactoring # |
Instance details Defined in Refact.Types Methods fmap :: (a -> b) -> Refactoring a -> Refactoring b # (<$) :: a -> Refactoring b -> Refactoring a #
Data a => Data (Refactoring a) # |
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) # 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 :: forall r r'. (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) #
Read a => Read (Refactoring a) # |
Instance details Defined in Refact.Types Methods readsPrec :: Int -> ReadS (Refactoring a) # readList :: ReadS [Refactoring a] # readPrec :: ReadPrec (Refactoring a) # readListPrec :: ReadPrec [Refactoring a] #
Show a => Show (Refactoring a) # |
Instance details Defined in Refact.Types Methods showsPrec :: Int -> Refactoring a -> ShowS # show :: Refactoring a -> String # showList :: [Refactoring a] -> ShowS #
Eq a => Eq (Refactoring a) # |
Instance details Defined in Refact.Types Methods (==) :: Refactoring a -> Refactoring a -> Bool # (/=) :: Refactoring a -> Refactoring a -> Bool #
Ord a => Ord (Refactoring a) # |
Instance details Defined in Refact.Types 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 #