hsimport 0.2.11 → 0.3
raw patch · 20 files changed
+257/−95 lines, 20 files
Files
- README.md +20/−4
- hsimport.cabal +2/−2
- lib/HsImport.hs +2/−0
- lib/HsImport/Args.hs +18/−0
- lib/HsImport/ImportChange.hs +51/−28
- lib/HsImport/ImportSpec.hs +14/−9
- lib/HsImport/Symbol.hs +12/−0
- tests/Main.hs +57/−52
- tests/goldenFiles/SymbolTest20.hs +7/−0
- tests/goldenFiles/SymbolTest21.hs +7/−0
- tests/goldenFiles/SymbolTest22.hs +7/−0
- tests/goldenFiles/SymbolTest23.hs +7/−0
- tests/goldenFiles/SymbolTest24.hs +7/−0
- tests/goldenFiles/SymbolTest25.hs +7/−0
- tests/inputFiles/SymbolTest20.hs +6/−0
- tests/inputFiles/SymbolTest21.hs +7/−0
- tests/inputFiles/SymbolTest22.hs +7/−0
- tests/inputFiles/SymbolTest23.hs +7/−0
- tests/inputFiles/SymbolTest24.hs +6/−0
- tests/inputFiles/SymbolTest25.hs +6/−0
README.md view
@@ -17,15 +17,27 @@ Examples -------- - $ hsimport -m 'Control.Monad' SomeSource.hs`+ $> hsimport -m 'Control.Monad' SomeSource.hs` => import Control.Monad - $ hsimport -m 'Control.Monad' -s 'when' SomeSource.hs+ $> hsimport -m 'Control.Monad' -s 'when' SomeSource.hs => import Control.Monad (when) - $ hsimport -m 'Control.Monad' -q 'CM' SomeSource.hs+ $> hsimport -m 'Control.Monad' -q 'CM' SomeSource.hs => import qualified Control.Monad as CM + $> hsimport -m 'Data.Maybe' -s 'Maybe'+ => import Data.Maybe (Maybe)++ $> hsimport -m 'Data.Maybe' -s 'Maybe' -a+ => import Data.Maybe (Maybe(..))++ $> hsimport -m 'Data.Maybe' -s 'Maybe' -w 'Just'+ => import Data.Maybe (Maybe(Just))++ $> hsimport -m 'Data.Maybe' -s 'Maybe' -w 'Just' -w 'Nothing'+ => import Data.Maybe (Maybe(Just, Nothing))+ Text Editor Integration ----------------------- @@ -34,7 +46,7 @@ Command Line Usage ------------------ - dan@machine ~> hsimport --help+ $> hsimport --help hsimport [OPTIONS] [SOURCEFILE] A command line program for extending the import list of a Haskell source file.@@ -43,6 +55,10 @@ -m --modulename=ITEM The module to import -s --symbolname=ITEM The symbol to import, if empty, the entire module is imported+ -a --all All constructors or methods of the symbol should+ be imported: 'Symbol(..)'+ -w --with=ITEM The constructors or methods of the symbol+ should be imported: 'Symbol(With)' -q --qualifiedname=ITEM The name to use for a qualified module import -o --outputsrcfile=FILE Save modified source file to file, if empty, the source file is modified inplace
hsimport.cabal view
@@ -1,5 +1,5 @@ name: hsimport-version: 0.2.11+version: 0.3 cabal-version: >=1.9.2 build-type: Simple license: BSD3@@ -24,7 +24,7 @@ split >=0.2.2 && <0.3, attoparsec >=0.10.4.0 && <0.12, directory >=1.2.0.1 && <1.3 exposed-modules: HsImport HsImport.Args HsImport.ImportSpec- HsImport.Main+ HsImport.Symbol HsImport.Main exposed: True buildable: True cpp-options: -DCABAL
lib/HsImport.hs view
@@ -3,9 +3,11 @@ ( HsImportArgs , hsImportArgs , module HsImport.ImportSpec+ , module HsImport.Symbol , module HsImport.Main ) where import HsImport.Args import HsImport.ImportSpec+import HsImport.Symbol import HsImport.Main
lib/HsImport/Args.hs view
@@ -3,8 +3,10 @@ module HsImport.Args ( HsImportArgs(..) , hsImportArgs+ , defaultArgs ) where +import Prelude hiding (all) import System.Console.CmdArgs #ifdef CABAL@@ -15,6 +17,8 @@ data HsImportArgs = HsImportArgs { moduleName :: String , symbolName :: String+ , all :: Bool+ , with :: [String] , qualifiedName :: String , inputSrcFile :: FilePath , outputSrcFile :: FilePath@@ -25,6 +29,8 @@ hsImportArgs = cmdArgs $ HsImportArgs { moduleName = def &= help "The module to import" , symbolName = def &= help "The symbol to import, if empty, the entire module is imported"+ , all = def &= help "All constructors or methods of the symbol should be imported: 'Symbol(..)'"+ , with = def &= help "The constructors or methods of the symbol should be imported: 'Symbol(With)'" , qualifiedName = def &= help "The name to use for a qualified module import" , outputSrcFile = def &= help "Save modified source file to file, if empty, the source file is modified inplace" &= typFile , inputSrcFile = def &= args &= typ "SOURCEFILE"@@ -36,6 +42,18 @@ &= versionArg [explicit, name "version", name "v", summary versionInfo] where summaryInfo = ""+++defaultArgs :: HsImportArgs+defaultArgs = HsImportArgs+ { moduleName = def+ , symbolName = def+ , all = def+ , with = def+ , qualifiedName = def+ , inputSrcFile = def+ , outputSrcFile = def+ } versionInfo :: String
lib/HsImport/ImportChange.hs view
@@ -6,11 +6,13 @@ ) where import Data.Maybe-import Data.List (find)+import Data.List (find, (\\)) import Data.List.Split (splitOn) import Control.Lens import qualified Language.Haskell.Exts as HS import qualified Data.Attoparsec.Text as A+import Data.Monoid (mconcat)+import HsImport.Symbol (Symbol(..)) type SrcLine = Int type ImportString = String@@ -22,14 +24,14 @@ deriving (Show) -importChanges :: String -> Maybe String -> Maybe String -> HS.Module -> [ImportChange]-importChanges moduleName (Just symbolName) (Just qualifiedName) module_ =- [ importModuleWithSymbol moduleName symbolName module_+importChanges :: String -> Maybe Symbol -> Maybe String -> HS.Module -> [ImportChange]+importChanges moduleName (Just symbol) (Just qualifiedName) module_ =+ [ importModuleWithSymbol moduleName symbol module_ , importQualifiedModule moduleName qualifiedName module_ ] -importChanges moduleName (Just symbolName) Nothing module_ =- [ importModuleWithSymbol moduleName symbolName module_ ]+importChanges moduleName (Just symbol) Nothing module_ =+ [ importModuleWithSymbol moduleName symbol module_ ] importChanges moduleName Nothing (Just qualifiedName) module_ = [ importQualifiedModule moduleName qualifiedName module_ ]@@ -54,31 +56,38 @@ Nothing -> AddImportAtEnd (HS.prettyPrint $ importDecl moduleName) -importModuleWithSymbol :: String -> String -> HS.Module -> ImportChange-importModuleWithSymbol moduleName symbolName module_+importModuleWithSymbol :: String -> Symbol -> HS.Module -> ImportChange+importModuleWithSymbol moduleName symbol module_ | matching@(_:_) <- matchingImports moduleName module_ =- if any entireModuleImported matching || any (symbolImported symbolName) matching+ if any entireModuleImported matching || any (symbolImported symbol) matching then NoImportChange else case find hasImportedSymbols matching of Just impDecl ->- ReplaceImportAt (srcLine impDecl) (HS.prettyPrint $ addSymbol impDecl symbolName)+ ReplaceImportAt (srcLine impDecl) (prettyPrint $ addSymbol impDecl symbol) Nothing -> AddImportAfter (srcLine . last $ matching)- (HS.prettyPrint $ importDeclWithSymbol moduleName symbolName)+ (prettyPrint $ importDeclWithSymbol moduleName symbol) | Just bestMatch <- bestMatchingImport moduleName module_ =- AddImportAfter (srcLine bestMatch) (HS.prettyPrint $ importDeclWithSymbol moduleName symbolName)+ AddImportAfter (srcLine bestMatch) (prettyPrint $ importDeclWithSymbol moduleName symbol) | otherwise = case srcLineForNewImport module_ of- Just srcLine -> AddImportAfter srcLine (HS.prettyPrint $ importDeclWithSymbol moduleName symbolName)- Nothing -> AddImportAtEnd (HS.prettyPrint $ importDeclWithSymbol moduleName symbolName)+ Just srcLine -> AddImportAfter srcLine (prettyPrint $ importDeclWithSymbol moduleName symbol)+ Nothing -> AddImportAtEnd (prettyPrint $ importDeclWithSymbol moduleName symbol) where- addSymbol (id@HS.ImportDecl {HS.importSpecs = specs}) symbolName =- id {HS.importSpecs = specs & _Just . _2 %~ (++ [HS.IVar $ hsName symbolName])}+ addSymbol (id@HS.ImportDecl {HS.importSpecs = specs}) symbol =+ id {HS.importSpecs = specs & _Just . _2 %~ (++ [importSpec symbol])} + prettyPrint importDecl =+ -- remove newlines from pretty printed ImportDecl+ case lines $ HS.prettyPrint importDecl of+ (fst : [] ) -> fst+ (fst : rest) -> mconcat $ fst : (map (' ' :) . map (dropWhile (== ' ')) $ rest)+ _ -> "" + importQualifiedModule :: String -> String -> HS.Module -> ImportChange importQualifiedModule moduleName qualifiedName module_ | matching@(_:_) <- matchingImports moduleName module_ =@@ -149,25 +158,33 @@ | otherwise = False -symbolImported :: String -> HS.ImportDecl -> Bool+symbolImported :: Symbol -> HS.ImportDecl -> Bool symbolImported symbol import_- | Just (False, symbols) <- HS.importSpecs import_- , any (== symbol) (symbolStrings symbols)+ | Just (False, hsSymbols) <- HS.importSpecs import_+ , any (imports symbol) hsSymbols = True - | otherwise = False+ | otherwise + = False where- symbolStrings = map symbolString+ imports (Symbol symName) (HS.IVar name) = symName == nameString name+ imports (Symbol symName) (HS.IAbs name) = symName == nameString name+ imports (Symbol symName) (HS.IThingAll name) = symName == nameString name+ imports (Symbol symName) (HS.IThingWith name _) = symName == nameString name+ imports (AllOfSymbol symName) (HS.IThingAll name) = symName == nameString name+ imports (SomeOfSymbol symName _ ) (HS.IThingAll name) = symName == nameString name+ imports (SomeOfSymbol symName names) (HS.IThingWith hsSymName hsNames) =+ symName == nameString hsSymName && null (names \\ (map (nameString . toName) hsNames)) - symbolString (HS.IVar name) = nameString name- symbolString (HS.IAbs name) = nameString name- symbolString (HS.IThingAll name) = nameString name- symbolString (HS.IThingWith name _) = nameString name+ imports _ _ = False nameString (HS.Ident id) = id nameString (HS.Symbol sym) = sym + toName (HS.VarName name) = name+ toName (HS.ConName name) = name + hasImportedSymbols :: HS.ImportDecl -> Bool hasImportedSymbols import_ | Just (False, _:_) <- HS.importSpecs import_ = True@@ -186,9 +203,9 @@ } -importDeclWithSymbol :: String -> String -> HS.ImportDecl-importDeclWithSymbol moduleName symbolName =- (importDecl moduleName) { HS.importSpecs = Just (False, [HS.IVar $ hsName symbolName]) }+importDeclWithSymbol :: String -> Symbol -> HS.ImportDecl+importDeclWithSymbol moduleName symbol =+ (importDecl moduleName) { HS.importSpecs = Just (False, [importSpec symbol]) } qualifiedImportDecl :: String -> String -> HS.ImportDecl@@ -198,6 +215,12 @@ then Just $ HS.ModuleName qualifiedName else Nothing }+++importSpec :: Symbol -> HS.ImportSpec+importSpec (Symbol symName) = HS.IVar $ hsName symName+importSpec (AllOfSymbol symName) = HS.IThingAll $ hsName symName+importSpec (SomeOfSymbol symName names) = HS.IThingWith (hsName symName) (map (HS.VarName . hsName) names) hsName :: String -> HS.Name
lib/HsImport/ImportSpec.hs view
@@ -16,16 +16,18 @@ import qualified HsImport.Args as Args import HsImport.Args (HsImportArgs) import HsImport.Parse (parseFile)+import HsImport.Symbol (Symbol(..)) data ImportSpec = ImportSpec - { _sourceFile :: FilePath- , _parsedSrcFile :: HS.Module- , _moduleToImport :: String- , _symbolToImport :: Maybe String- , _qualifiedName :: Maybe String- , _saveToFile :: Maybe FilePath+ { _sourceFile :: FilePath+ , _parsedSrcFile :: HS.Module+ , _moduleToImport :: String+ , _symbolToImport :: Maybe Symbol+ , _qualifiedName :: Maybe String+ , _saveToFile :: Maybe FilePath } deriving (Show) + makeLenses ''ImportSpec @@ -38,7 +40,7 @@ case result of Right (HS.ParseOk modul) -> return $ Right $ ImportSpec (Args.inputSrcFile args) modul- (Args.moduleName args) symbolName+ (Args.moduleName args) symbol qualifiedName saveToFile Right (HS.ParseFailed srcLoc error) -> return $ Left (show srcLoc ++ error)@@ -46,10 +48,13 @@ Left error -> return $ Left error where- symbolName =+ symbol = case Args.symbolName args of "" -> Nothing- sym -> Just sym++ name | Args.all args -> Just $ AllOfSymbol name+ | ws@(_:_) <- Args.with args -> Just $ SomeOfSymbol name ws+ | otherwise -> Just $ Symbol name qualifiedName = case Args.qualifiedName args of
+ lib/HsImport/Symbol.hs view
@@ -0,0 +1,12 @@++module HsImport.Symbol+ ( Symbol(..)+ ) where++type Name = String++-- | What of the symbol should be imported.+data Symbol = Symbol Name -- ^ only the symbol should be imported+ | AllOfSymbol Name -- ^ all constructors or methods of the symbol should be imported: Symbol(..)+ | SomeOfSymbol Name [String] -- ^ some constructors or methods of the symbol should be imported: Symbol(X, Y) + deriving (Show)
tests/Main.hs view
@@ -6,7 +6,7 @@ import System.FilePath import System.IO (hPutStrLn, stderr) import HsImport (hsImport, hsImportSpec)-import qualified HsImport.Args as Args+import qualified HsImport.Args as A main = defaultMain tests @@ -15,68 +15,73 @@ moduleTests :: TestTree moduleTests = testGroup "Module Tests"- [ hsImportTest "ModuleTest0" "Foo.Bar" "" ""- , hsImportTest "ModuleTest1" "Foo.Bar" "" ""- , hsImportTest "ModuleTest2" "Foo.Bar.Blub" "" ""- , hsImportTest "ModuleTest3" "Control.Monad" "" ""- , hsImportTest "ModuleTest4" "Ugah.Argh2" "" ""- , hsImportTest "ModuleTest5" "Control.Monad" "" ""- , hsImportTest "ModuleTest6" "Control.Monad" "" ""- , hsImportTest "ModuleTest7" "Control.Monad" "" ""- , hsImportTest "ModuleTest8" "Control.Monad" "" ""- , hsImportTest "ModuleTest9" "Control.Monad" "" ""- , hsImportTest "ModuleTest10" "Control.Monad" "" ""- , hsImportTest "ModuleTest11" "Control.Monad" "" ""- , hsImportTest "ModuleTest12" "Control.Monad" "" ""- , hsImportTest "ModuleTest13" "Control.Monad" "" ""- , hsImportTest "ModuleTest14" "Control.Monad" "" ""- , hsImportTest "ModuleTest15" "Control.Monad" "" ""- , hsImportTest "ModuleTest16" "Control.Monad" "" ""- , hsImportTest "ModuleTest17" "Control.Monad" "" ""- , hsImportTest "ModuleTest18" "Control.Monad" "" ""- , hsImportTest "ModuleTest19" "Control.Monad" "" ""- , hsImportTest "ModuleTest20" "Control.Monad" "" ""- , hsImportTest "ModuleTest21" "Control.Monad" "" ""- , hsImportTest "ModuleTest22" "Control.Monad" "" ""- , hsImportTest "ModuleTest23" "Control.Monad" "" "CM"- , hsImportTest "ModuleTest24" "Control.Monad" "" "CM"- , hsImportTest "ModuleTest25" "Control.Monad" "" "Control.Monad"- , hsImportTest "ModuleTest26" "Control.Monad" "" ""+ [ test "ModuleTest0" $ A.defaultArgs { A.moduleName = "Foo.Bar" }+ , test "ModuleTest1" $ A.defaultArgs { A.moduleName = "Foo.Bar" }+ , test "ModuleTest2" $ A.defaultArgs { A.moduleName = "Foo.Bar.Blub" }+ , test "ModuleTest3" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest4" $ A.defaultArgs { A.moduleName = "Ugah.Argh2" }+ , test "ModuleTest5" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest6" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest7" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest8" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest9" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest10" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest11" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest12" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest13" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest14" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest15" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest16" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest17" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest18" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest19" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest20" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest21" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest22" $ A.defaultArgs { A.moduleName = "Control.Monad" }+ , test "ModuleTest23" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "CM" }+ , test "ModuleTest24" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "CM" }+ , test "ModuleTest25" $ A.defaultArgs { A.moduleName = "Control.Monad", A.qualifiedName = "Control.Monad" }+ , test "ModuleTest26" $ A.defaultArgs { A.moduleName = "Control.Monad" } ] symbolTests :: TestTree symbolTests = testGroup "Symbol Tests"- [ hsImportTest "SymbolTest0" "Foo.Bar" "foo" ""- , hsImportTest "SymbolTest1" "Foo.Bar" "foo" ""- , hsImportTest "SymbolTest2" "Foo.Bar.Blub" "foo" ""- , hsImportTest "SymbolTest3" "Control.Monad" "when" ""- , hsImportTest "SymbolTest4" "Ugah.Argh2" "argh" ""- , hsImportTest "SymbolTest5" "Control.Monad" "when" ""- , hsImportTest "SymbolTest6" "Control.Monad" "unless" ""- , hsImportTest "SymbolTest7" "Control.Monad" "unless" ""- , hsImportTest "SymbolTest8" "Control.Monad" "unless" ""- , hsImportTest "SymbolTest9" "Control.Monad" "unless" ""- , hsImportTest "SymbolTest10" "Control.Applicative" "<$>" ""- , hsImportTest "SymbolTest11" "Control.Applicative" "<$>" ""- , hsImportTest "SymbolTest12" "Control.Applicative" "<$>" ""- , hsImportTest "SymbolTest13" "Control.Applicative" "<*" ""- , hsImportTest "SymbolTest14" "Control.Applicative" "<*" ""- , hsImportTest "SymbolTest15" "Control.Applicative" "*>" ""- , hsImportTest "SymbolTest16" "Control.Monad" "when" "CM"- , hsImportTest "SymbolTest17" "Control.Monad" "when" "CM"- , hsImportTest "SymbolTest18" "Data.Text" "Text" ""- , hsImportTest "SymbolTest19" "Data.List" "foldl'" ""+ [ test "SymbolTest0" $ A.defaultArgs { A.moduleName = "Foo.Bar", A.symbolName = "foo" }+ , test "SymbolTest1" $ A.defaultArgs { A.moduleName = "Foo.Bar", A.symbolName = "foo" }+ , test "SymbolTest2" $ A.defaultArgs { A.moduleName = "Foo.Bar.Blub", A.symbolName = "foo" }+ , test "SymbolTest3" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when" }+ , test "SymbolTest4" $ A.defaultArgs { A.moduleName = "Ugah.Argh2", A.symbolName = "argh" }+ , test "SymbolTest5" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when" }+ , test "SymbolTest6" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }+ , test "SymbolTest7" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }+ , test "SymbolTest8" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }+ , test "SymbolTest9" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "unless" }+ , test "SymbolTest10" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }+ , test "SymbolTest11" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }+ , test "SymbolTest12" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<$>" }+ , test "SymbolTest13" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<*" }+ , test "SymbolTest14" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "<*" }+ , test "SymbolTest15" $ A.defaultArgs { A.moduleName = "Control.Applicative", A.symbolName = "*>" }+ , test "SymbolTest16" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when", A.qualifiedName = "CM" }+ , test "SymbolTest17" $ A.defaultArgs { A.moduleName = "Control.Monad", A.symbolName = "when", A.qualifiedName = "CM" }+ , test "SymbolTest18" $ A.defaultArgs { A.moduleName = "Data.Text", A.symbolName = "Text" }+ , test "SymbolTest19" $ A.defaultArgs { A.moduleName = "Data.List", A.symbolName = "foldl'" }+ , test "SymbolTest20" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True }+ , test "SymbolTest21" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True }+ , test "SymbolTest22" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Just"] }+ , test "SymbolTest23" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.all = True, A.with = ["Just"] }+ , test "SymbolTest24" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Just"] }+ , test "SymbolTest25" $ A.defaultArgs { A.moduleName = "Data.Maybe", A.symbolName = "Maybe", A.with = ["Nothing", "Just"] } ] -hsImportTest :: String -> String -> String -> String -> TestTree-hsImportTest testName moduleName symbolName qualifiedName =+test :: String -> A.HsImportArgs -> TestTree+test testName args = goldenVsFileDiff testName diff goldenFile outputFile command where command = do- let args = Args.HsImportArgs moduleName symbolName qualifiedName inputFile outputFile- spec <- hsImportSpec args+ spec <- hsImportSpec (args { A.inputSrcFile = inputFile, A.outputSrcFile = outputFile }) case spec of Left error -> hPutStrLn stderr ("hsimport: " ++ error) Right spec_ -> hsImport spec_
+ tests/goldenFiles/SymbolTest20.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/goldenFiles/SymbolTest21.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/goldenFiles/SymbolTest22.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/goldenFiles/SymbolTest23.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/goldenFiles/SymbolTest24.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(Just))
+ tests/goldenFiles/SymbolTest25.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(Nothing, Just))
+ tests/inputFiles/SymbolTest20.hs view
@@ -0,0 +1,6 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)
+ tests/inputFiles/SymbolTest21.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/inputFiles/SymbolTest22.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/inputFiles/SymbolTest23.hs view
@@ -0,0 +1,7 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)+import Data.Maybe (Maybe(..))
+ tests/inputFiles/SymbolTest24.hs view
@@ -0,0 +1,6 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)
+ tests/inputFiles/SymbolTest25.hs view
@@ -0,0 +1,6 @@+module Blub+ ( blub+ , foo+ , bar+ ) where+import Data.Text (Text)