From 3e742cb6e7eb35045fc8e2dffa9c7044a5f705b4 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Sat, 20 Jul 2024 18:39:04 -0400 Subject: [PATCH] broke `drawFunc` out into `Hamming.App.Draw` module --- hamming.cabal | 1 + src/Hamming/App.hs | 7 ++----- src/Hamming/App/Draw.hs | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/Hamming/App/Draw.hs diff --git a/hamming.cabal b/hamming.cabal index ccf8de5..ce11308 100644 --- a/hamming.cabal +++ b/hamming.cabal @@ -23,6 +23,7 @@ library exposed-modules: Hamming Hamming.App + Hamming.App.Draw Hamming.App.Types Hamming.App.Widgets Hamming.App.Widgets.Internal diff --git a/src/Hamming/App.hs b/src/Hamming/App.hs index 988cf44..c7dc80e 100644 --- a/src/Hamming/App.hs +++ b/src/Hamming/App.hs @@ -28,11 +28,11 @@ module Hamming.App (mainApp, initialState) where import Brick.AttrMap (forceAttrMap) import Brick.Main (App (..), halt, neverShowCursor) -import Brick.Types (BrickEvent, EventM, Widget) +import Brick.Types (BrickEvent, EventM) import Brick.Util (style) +import Hamming.App.Draw import Hamming.App.Types -import Hamming.App.Widgets mainApp :: App AppState () ResName mainApp = App @@ -43,9 +43,6 @@ mainApp = App , appAttrMap = const $ forceAttrMap $ style 0 } -drawFunc :: AppState -> [Widget ResName] -drawFunc s = [hammingW s] - eventHandler :: BrickEvent ResName () -> EventM ResName AppState () diff --git a/src/Hamming/App/Draw.hs b/src/Hamming/App/Draw.hs new file mode 100644 index 0000000..a3fce79 --- /dev/null +++ b/src/Hamming/App/Draw.hs @@ -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 +. + +|-} + +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