packages feed

timeutils-0.1.0: app/Main.hs

{-

timeutils

Copyright (C) 2019 Jonathan Lamothe
<jlamothe1980@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

-}

module Main where

import Brick.BChan (writeBChan)
import Brick.Main (App (..), customMain, neverShowCursor)
import Graphics.Vty (mkVty)
import Graphics.Vty.Config (defaultConfig)
import Control.Monad (void)

import Logic
import Types
import UI

app :: App ProgState () ()
app = App
  { appDraw         = draw
  , appChooseCursor = neverShowCursor
  , appHandleEvent  = handleEvent
  , appStartEvent   = return
  , appAttrMap      = mkAttrMap
  }

main :: IO ()
main = do
  s <- newProgState
  writeBChan (channel s) ()
  let buildVty = mkVty defaultConfig
  vty <- buildVty
  void $ customMain vty buildVty (Just $ channel s) app s

-- jl