ncurses framework

This commit is contained in:
Jonathan Lamothe 2019-08-13 10:11:10 -04:00
parent a95d8af96c
commit 44f596102e
7 changed files with 34 additions and 11 deletions

View File

@ -1,6 +1,9 @@
module Main where module Main where
import Lib import Control.Monad.Trans.State (evalStateT)
import UI.NCurses (runCurses)
import Mtlstats
main :: IO () main :: IO ()
main = someFunc main = runCurses $ initState >>= evalStateT mainLoop

View File

@ -23,7 +23,9 @@ dependencies:
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- aeson >= 1.4.4.0 && < 1.5 - aeson >= 1.4.4.0 && < 1.5
- microlens-th >= 0.4.2.3 && < 0.5 - microlens-th >= 0.4.2.3 && < 0.5
- ncurses >= 0.2.16 && < 0.3
- raw-strings-qq >= 1.1 && < 1.2 - raw-strings-qq >= 1.1 && < 1.2
- transformers >= 0.5.6.2 && < 0.6
- bytestring - bytestring
- microlens - microlens
@ -31,7 +33,7 @@ library:
source-dirs: src source-dirs: src
executables: executables:
mtlstats-exe: mtlstats:
main: Main.hs main: Main.hs
source-dirs: app source-dirs: app
ghc-options: ghc-options:

View File

@ -1,6 +0,0 @@
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"

12
src/Mtlstats.hs Normal file
View File

@ -0,0 +1,12 @@
module Mtlstats (initState, mainLoop) where
import Control.Monad.Trans.State (StateT)
import UI.NCurses (Curses)
import Mtlstats.Types
initState :: Curses ProgState
initState = return ProgState
mainLoop :: StateT ProgState Curses ()
mainLoop = return ()

View File

@ -2,6 +2,7 @@
module Mtlstats.Types ( module Mtlstats.Types (
-- * Types -- * Types
ProgState (..),
Player (..), Player (..),
PlayerStats (..), PlayerStats (..),
Goalie (..), Goalie (..),
@ -54,6 +55,9 @@ import Data.Aeson
import Lens.Micro ((^.)) import Lens.Micro ((^.))
import Lens.Micro.TH (makeLenses) import Lens.Micro.TH (makeLenses)
-- | Represents the program state
data ProgState = ProgState
-- | Represents a (non-goalie) player -- | Represents a (non-goalie) player
data Player = Player data Player = Player
{ _pNumber :: Int { _pNumber :: Int

View File

@ -39,7 +39,8 @@ packages:
# - git: https://github.com/commercialhaskell/stack.git # - git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# #
# extra-deps: [] extra-deps:
- ncurses-0.2.16@sha256:8ad9fe6562a80d28166d76adbac1eb4d40c6511fe4e9272ed6e1166dc2f1cdf1,3575
# Override default flag values for local packages and extra-deps # Override default flag values for local packages and extra-deps
# flags: {} # flags: {}

View File

@ -3,7 +3,14 @@
# For more information, please see the documentation at: # For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files # https://docs.haskellstack.org/en/stable/lock_files
packages: [] packages:
- completed:
hackage: ncurses-0.2.16@sha256:8ad9fe6562a80d28166d76adbac1eb4d40c6511fe4e9272ed6e1166dc2f1cdf1,3575
pantry-tree:
size: 674
sha256: 093bdc85ed518c81724f5b6b81c24ab4ebdd231551861f4feaa43361136f70b7
original:
hackage: ncurses-0.2.16@sha256:8ad9fe6562a80d28166d76adbac1eb4d40c6511fe4e9272ed6e1166dc2f1cdf1,3575
snapshots: snapshots:
- completed: - completed:
size: 523443 size: 523443