main :: IO ()
main = do
  eventChannel <- newBChan 1
  lexerChannel <- liftIO newEmptyMVar

  liftIO $ startGhc eventChannel lexerChannel

  let callback = putMVar lexerChannel
  
  -- TODO: this debounces input events
  -- trigger <- Fdeb.new Fdeb.Args { Fdeb.cb = callback, Fdeb.fold = \_ i -> i, Fdeb.init = "" }
  --                     Fdeb.def { Fdeb.delay = 100000 }
  -- let sendSource = Fdeb.send trigger
  -- let initSt = initialState sendSource
  
  let initSt = initialState callback
  
  st <- M.customMain (V.mkVty V.defaultConfig) (Just eventChannel) theApp initSt

  putStrLn "In input 1 you entered:\n"
  putStrLn $ Y.toString $ E.getEditContents $ st^.edit1
main :: IO ()
main = do
  eventChannel <- newBChan 1
  lexerChannel <- liftIO newEmptyMVar

  liftIO $ startGhc eventChannel lexerChannel

  let callback = putMVar lexerChannel
  
  -- TODO: this debounces input events
  -- trigger <- Fdeb.new Fdeb.Args { Fdeb.cb = callback, Fdeb.fold = \_ i -> i, Fdeb.init = "" }
  --                     Fdeb.def { Fdeb.delay = 100000 }
  -- let sendSource = Fdeb.send trigger
  -- let initSt = initialState sendSource
  
  let initSt = initialState callback
  
  st <- M.customMain (V.mkVty V.defaultConfig) (Just eventChannel) theApp initSt

  putStrLn "In input 1 you entered:\n"
  putStrLn $ Y.toString $ E.getEditContents $ st^.edit1
main = do
  eventChannel <- newBChan 1
  lexerChannel <- liftIO newEmptyMVar

  liftIO $ startGhc eventChannel lexerChannel

  let callback = putMVar lexerChannel
  
  -- TODO: this debounces input events
  -- trigger <- Fdeb.new Fdeb.Args { Fdeb.cb = callback, Fdeb.fold = \_ i -> i, Fdeb.init = "" }
  --                     Fdeb.def { Fdeb.delay = 100000 }
  -- let sendSource = Fdeb.send trigger
  -- let initSt = initialState sendSource
  
  let initSt = initialState callback
  
  st <- M.customMain (V.mkVty V.defaultConfig) (Just eventChannel) theApp initSt

  putStrLn "In input 1 you entered:\n"
  putStrLn $ Y.toString $ E.getEditContents $ st^.edit1