From 566109306b2c98a8d27a4a2f6bbdfc28028cbdaf Mon Sep 17 00:00:00 2001 From: depsterr Date: Mon, 13 Sep 2021 19:00:26 +0200 Subject: [PATCH] minor additions --- kino.cabal | 2 ++ src/JSONTypes.hs | 2 -- src/Request.hs | 2 -- src/UI.hs | 24 +++++++++++++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/kino.cabal b/kino.cabal index 515c99d..a471680 100644 --- a/kino.cabal +++ b/kino.cabal @@ -20,6 +20,7 @@ library , Torrent other-modules: -- other-extensions: + ghc-options: -Wall build-depends: base ^>=4.14.1.0 , wreq , aeson @@ -36,6 +37,7 @@ executable kino main-is: Main.hs -- other-modules: -- other-extensions: + ghc-options: -Wall build-depends: base ^>=4.14.1.0 , kino , brick diff --git a/src/JSONTypes.hs b/src/JSONTypes.hs index 4d784c3..ffae0f2 100644 --- a/src/JSONTypes.hs +++ b/src/JSONTypes.hs @@ -5,8 +5,6 @@ module JSONTypes where import Data.Aeson import Data.Aeson.Types import qualified Data.Text as T -import Data.Aeson.Lens (key, nth) -import qualified Data.ByteString.Lazy.Internal as BL data JSONResponse d = JSONResponse { resp_status :: T.Text diff --git a/src/Request.hs b/src/Request.hs index b33b387..68078c8 100644 --- a/src/Request.hs +++ b/src/Request.hs @@ -9,8 +9,6 @@ import qualified Network.Wreq as WR (Options) import Control.Lens import Data.Aeson import Data.Text as T -import Data.Aeson.Lens (key, nth) -import qualified Data.ByteString.Lazy as BL makeRequest :: (FromJSON a) => String -> WR.Options -> IO (Either T.Text a) makeRequest url opts = do diff --git a/src/UI.hs b/src/UI.hs index 169f5c6..61e3672 100644 --- a/src/UI.hs +++ b/src/UI.hs @@ -3,22 +3,36 @@ module UI where import Brick import Brick.Main -data Identifiers = Nil +data Ident = Nil -data AppState = Null +data AppS = Null -app :: App AppState () Identifiers +app :: App AppS () Ident app = App { appDraw = draw , appChooseCursor = chooseCursor - , appHandleEvent = eventHandler + , appHandleEvent = eventHandler + , appStartEvent = startEvent + , appAttrMap = attributeMap } +runApp :: IO AppS +runApp = defaultMain app initialState +initialState :: AppS +initialState = undefined + +startEvent :: EventM Ident (Next Apps) +startEvent = return -- replace if needed + +draw :: AppS -> [Widget Ident] draw = undefined -chooseCursor = undefined +chooseCursor :: AppS -> [CursorLocation Ident] -> Maybe (CursorLocation Ident) +chooseCursor = showFirstCursor -- replace if needed +eventHandler :: AppS -> BrickEvent Identifier () -> EventM Ident (Next AppS) eventHandler = undefined +attributeMap :: AttrMap attributeMap = undefined