made command-line-args static so we can debug properly

This commit is contained in:
Nicole Dresselhaus 2013-11-27 16:38:54 +01:00
parent 31f0468cfd
commit 77bb358198
3 changed files with 19 additions and 16 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@
*.eventlog
*.lkshf
/.dist-buildwrapper
.project*

4
dist/setup-config vendored

File diff suppressed because one or more lines are too long

View File

@ -61,13 +61,13 @@ createAttr input = createAttr' (T.split (=='\t') input) (Left [])
createAttr' :: [T.Text] -> Either [Double] T.Text -> Either [Double] T.Text
createAttr' (a:as) r =
let this = read (T.unpack a) :: Double in
case isNaN this of
True -> Right $ T.append (T.pack "cannot parse ") a
_ ->
let next = (createAttr' as r) in
(if isNaN this then
Right $ T.append (T.pack "cannot parse ") a
else
(let next = (createAttr' as r) in
case next of
Left rs -> Left (this : rs)
_ -> next
_ -> next))
emptyLine :: T.Text -> Bool
emptyLine a
@ -105,13 +105,14 @@ infixl 1 +||
a +|| b = a `using` b
exeMain = do
args <- getArgs
input <- case args of
["--help"] -> showHelp
["-h"] -> showHelp
[] -> error "Error: No filename or stdinput (-) given."
[adj, attr] -> Prelude.mapM B.readFile [adj, attr]
_ -> error "Wrong arguments given"
-- args <- getArgs
-- input <- case args of
-- ["--help"] -> showHelp
-- ["-h"] -> showHelp
-- [] -> error "Error: No filename or stdinput (-) given."
-- [adj, attr] -> Prelude.mapM B.readFile [adj, attr]
-- _ -> error "Wrong arguments given"
input <- Prelude.mapM B.readFile ["sampledata.adj","sampledata.adj.atr"]
-- read file and clean
adjMat <- return $ L.filter (not . emptyLine) (T.lines (decodeUtf8 (head input)))
attrMat <- return $ L.filter (not . emptyLine) (T.lines (decodeUtf8 ((head . L.tail) input)))