refact (empty) → 0.1.0.0
raw patch · 6 files changed
+108/−0 lines, 6 filesdep +basesetup-changed
Dependencies added: base
Files
- CHANGELOG +3/−0
- LICENSE +30/−0
- README.md +1/−0
- Setup.hs +2/−0
- refact.cabal +30/−0
- src/Refact/Types.hs +42/−0
+ CHANGELOG view
@@ -0,0 +1,3 @@+# 0.1++Initial Release
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (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.
+ README.md view
@@ -0,0 +1,1 @@+Specify refactorings to apply with [apply-refact](http://github.com/mpickering/apply-refact).
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ refact.cabal view
@@ -0,0 +1,30 @@+-- Initial refact.cabal generated by cabal init. For further+-- documentation, see http://haskell.org/cabal/users-guide/++name: refact+version: 0.1.0.0+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+data-files: README.md+ ,CHANGELOG+cabal-version: >=1.10++library+ exposed-modules: Refact.Types+ -- other-modules:+ -- other-extensions:+ build-depends: base >=4.8 && <4.9+ hs-source-dirs: src+ default-language: Haskell2010++Source-repository head+ type: git+ location: git://github.com/mpickering/refact.git
+ src/Refact/Types.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE DeriveFunctor #-}+module Refact.Types where++-- | A generic SrcSpan, usually this is converted immediately to a native+-- representation. (For example a GHC SrcSpan or a HSE SrcSpan)+data SrcSpan = SrcSpan+ { start :: (Int, Int)+ , end :: (Int, Int) } deriving (Read, Show, Eq, Ord)+++-- | Types of expressions which we are able to replace.+data RType = Expr | Decl | Type | Pattern | Stmt | ModuleName | Bind | Match deriving (Read, Ord, Show, Eq)++-- | 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 {+ pos :: a+ }+ | RemoveAsKeyword { -- ^ Takes the position of a import decl and removes the as keyword+ pos :: a+ }+-- | Rename {+-- nameSubts :: [(String, String)]+-- }+ deriving (Show, Read, Functor, Eq, Ord)+++