refact-0.3.0.2/0000755000000000000000000000000012624172704011311 5ustar0000000000000000refact-0.3.0.2/CHANGELOG0000644000000000000000000000034712624172704012527 0ustar0000000000000000# 0.3.0.1 * Fix documentation # 0.3 * Added `Import` to `RType`. * Added an rtype field to `Delete`. # 0.2 * Changed representation of SrcSpan as suggested by #1. * Added Data and Typeable instances. # 0.1 * Initial Release refact-0.3.0.2/LICENSE0000644000000000000000000000277412624172704012330 0ustar0000000000000000Copyright (c) 2015, Matthew Pickering All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Matthew Pickering nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. refact-0.3.0.2/README.md0000644000000000000000000000013612624172704012570 0ustar0000000000000000Specify refactorings to apply with [apply-refact](http://github.com/mpickering/apply-refact). refact-0.3.0.2/refact.cabal0000644000000000000000000000205112624172704013537 0ustar0000000000000000-- Initial refact.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ name: refact version: 0.3.0.2 synopsis: Specify refactorings to perform with apply-refact description: This library provides a datatype which can be interpreted by apply-refact. It exists as a seperate library so that applications can specify refactorings without depending on GHC. license: BSD3 license-file: LICENSE author: Matthew Pickering maintainer: matthewtpickering@gmail.com -- copyright: category: Development build-type: Simple extra-source-files: README.md , CHANGELOG cabal-version: >=1.10 library exposed-modules: Refact.Types -- other-modules: -- other-extensions: build-depends: base >=4 && <5 hs-source-dirs: src default-language: Haskell2010 Source-repository head type: git location: git://github.com/mpickering/refact.git refact-0.3.0.2/Setup.hs0000644000000000000000000000005612624172704012746 0ustar0000000000000000import Distribution.Simple main = defaultMain refact-0.3.0.2/src/0000755000000000000000000000000012624172704012100 5ustar0000000000000000refact-0.3.0.2/src/Refact/0000755000000000000000000000000012624172704013304 5ustar0000000000000000refact-0.3.0.2/src/Refact/Types.hs0000644000000000000000000000266512624172704014755 0ustar0000000000000000{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveDataTypeable #-} module Refact.Types where import Data.Data -- | A generic SrcSpan, usually this is converted immediately to a native -- representation. (For example a GHC SrcSpan or a HSE SrcSpan) data SrcSpan = SrcSpan { startLine :: {-# UNPACK #-} !Int , startCol :: {-# UNPACK #-} !Int , endLine :: {-# UNPACK #-} !Int , endCol :: {-# UNPACK #-} !Int } deriving (Read, Show, Eq, Ord, Data, Typeable) -- | Types of expressions which we are able to replace. data RType = Expr | Decl | Type | Pattern | Stmt | ModuleName | Bind | Match | Import deriving (Read, Ord, Show, Eq, Data, Typeable) -- | Supported refactorings data Refactoring a = Replace { rtype :: RType -- ^ Type of expression to be replaced , pos :: a -- ^ Expression to replace , subts :: [(String, a)] -- ^ Substitutions to make , orig :: String -- ^ Replacement template } | ModifyComment { pos :: a , newComment :: String } | InsertComment { pos :: a , newComment :: String } | Delete { rtype :: RType , pos :: a } | -- | Takes the position of a import decl and removes the as keyword RemoveAsKeyword { pos :: a } -- | Rename { -- nameSubts :: [(String, String)] -- } deriving (Show, Read, Functor, Eq, Ord, Data, Typeable )