broke drawFunc out into Hamming.App.Draw module

This commit is contained in:
Jonathan Lamothe 2024-07-20 18:39:04 -04:00
parent 7531cf192f
commit 3e742cb6e7
3 changed files with 40 additions and 5 deletions

View File

@ -23,6 +23,7 @@ library
exposed-modules: exposed-modules:
Hamming Hamming
Hamming.App Hamming.App
Hamming.App.Draw
Hamming.App.Types Hamming.App.Types
Hamming.App.Widgets Hamming.App.Widgets
Hamming.App.Widgets.Internal Hamming.App.Widgets.Internal

View File

@ -28,11 +28,11 @@ module Hamming.App (mainApp, initialState) where
import Brick.AttrMap (forceAttrMap) import Brick.AttrMap (forceAttrMap)
import Brick.Main (App (..), halt, neverShowCursor) import Brick.Main (App (..), halt, neverShowCursor)
import Brick.Types (BrickEvent, EventM, Widget) import Brick.Types (BrickEvent, EventM)
import Brick.Util (style) import Brick.Util (style)
import Hamming.App.Draw
import Hamming.App.Types import Hamming.App.Types
import Hamming.App.Widgets
mainApp :: App AppState () ResName mainApp :: App AppState () ResName
mainApp = App mainApp = App
@ -43,9 +43,6 @@ mainApp = App
, appAttrMap = const $ forceAttrMap $ style 0 , appAttrMap = const $ forceAttrMap $ style 0
} }
drawFunc :: AppState -> [Widget ResName]
drawFunc s = [hammingW s]
eventHandler eventHandler
:: BrickEvent ResName () :: BrickEvent ResName ()
-> EventM ResName AppState () -> EventM ResName AppState ()

37
src/Hamming/App/Draw.hs Normal file
View File

@ -0,0 +1,37 @@
{-|
Module : Hamming.App.Draw
Description : Utilities for working with Hamming codes
Copyright : (C) Jonathan Lamothe
License : AGPL-3.0-or-later
Maintainer : jonathan@jlamothe.net
Stability : experimental
Portability : POSIX
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public
License along with this program. If not, see
<https://www.gnu.org/licenses/>.
|-}
module Hamming.App.Draw (drawFunc) where
import Brick.Types (Widget)
import Hamming.App.Types
import Hamming.App.Widgets
drawFunc :: AppState -> [Widget ResName]
drawFunc s = [hammingW s]
--jl