Skip to content
Snippets Groups Projects
Commit f5197d89 authored by Iustin Pop's avatar Iustin Pop
Browse files

Change the signatures of the text loader slightly

This is in preparation for the text format changes.
parent f6044dc4
No related branches found
No related tags found
No related merge requests found
......@@ -80,11 +80,10 @@ loadInst _ s = fail $ "Invalid/incomplete instance data: '" ++ show s ++ "'"
-- @gnt-instance list@ and @gnt-node list@ to a list of objects using
-- a supplied conversion function.
loadTabular :: (Monad m, Element a) =>
String -> ([String] -> m (String, a))
[String] -> ([String] -> m (String, a))
-> m ([(String, Int)], [(Int, a)])
loadTabular text_data convert_fn = do
let lines_data = lines text_data
rows = map (sepSplit '|') lines_data
loadTabular lines_data convert_fn = do
let rows = map (sepSplit '|') lines_data
kerows <- mapM convert_fn rows
return $ assignIndices kerows
......@@ -97,7 +96,7 @@ loadData nfile ifile = do -- IO monad
idata <- readFile ifile
return $ do
{- node file: name t_mem n_mem f_mem t_disk f_disk -}
(ktn, nl) <- loadTabular ndata loadNode
(ktn, nl) <- loadTabular (lines ndata) loadNode
{- instance file: name mem disk status pnode snode -}
(_, il) <- loadTabular idata (loadInst ktn)
(_, il) <- loadTabular (lines idata) (loadInst ktn)
return (nl, il, [])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment