X-Git-Url: https://git.danieliu.xyz/?p=ekitaihs.git;a=blobdiff_plain;f=Ekitai.hs;fp=Ekitai.hs;h=6b9806ff0c00ce4764bf69a35458de0bd2fbdbb5;hp=6c1609ec7047d4b64d4fcaa68d086203eec33502;hb=112ba19bd1df10cdb24e99dd3853dd99576c1610;hpb=259904bfc4ca2f8b90381dfdb887750b9bdaf368 diff --git a/Ekitai.hs b/Ekitai.hs index 6c1609e..6b9806f 100644 --- a/Ekitai.hs +++ b/Ekitai.hs @@ -11,16 +11,26 @@ import Render -- ui :: B.Widget () -- ui = B.str "hello" <+> B.str "World" +hGetLines :: Handle -> IO [String] +hGetLines h = do + line <- hGetLine h + isEof <- hIsEOF h + if isEof then return [line] + else do + lines <- hGetLines h + return (line:lines) + main = do argv <- getArgs (opts, fname) <- ekitaiOpts argv handle <- openFile fname ReadMode - contents <- hGetContents handle - putStr contents + contents <- hGetLines handle hClose handle - initialState <- buildInitialState $ stringToSim 10 10 contents + -- putStrLn $ show $ stringToSim contents + initialState <- buildInitialState $ stringToSim contents endState <- B.defaultMain ekitaiApp initialState print endState + return 0 -- main :: IO () -- main = do