X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=Ekitai.hs;h=6b9806ff0c00ce4764bf69a35458de0bd2fbdbb5;hb=112ba19bd1df10cdb24e99dd3853dd99576c1610;hp=6fe1195234d822b5dd13faeeef1c7d767e9f7e79;hpb=c68579ccc2b03996eec6ac5c1526d6e5d20c3c78;p=ekitaihs.git diff --git a/Ekitai.hs b/Ekitai.hs index 6fe1195..6b9806f 100644 --- a/Ekitai.hs +++ b/Ekitai.hs @@ -1,4 +1,5 @@ import System.Environment +import System.IO import qualified Data.Vector as V import qualified Brick as B @@ -10,12 +11,28 @@ import Render -- ui :: B.Widget () -- ui = B.str "hello" <+> B.str "World" --- main :: IO () +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 - initialState <- buildInitialState + argv <- getArgs + (opts, fname) <- ekitaiOpts argv + handle <- openFile fname ReadMode + contents <- hGetLines handle + hClose handle + -- putStrLn $ show $ stringToSim contents + initialState <- buildInitialState $ stringToSim contents endState <- B.defaultMain ekitaiApp initialState print endState - -- argv <- getArgs - -- (opts, fname) <- ekitaiOpts argv + return 0 + +-- main :: IO () +-- main = do -- return 0