From 8f0bd22f908750fa610622e8f4208c6297790779 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 21 Aug 2019 00:50:22 -0400 Subject: [PATCH] added haddock comments and default menu return value --- src/Mtlstats/Types/Menu.hs | 12 ++++++++++-- test/Types/MenuSpec.hs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Mtlstats/Types/Menu.hs b/src/Mtlstats/Types/Menu.hs index fb08f97..8bc9476 100644 --- a/src/Mtlstats/Types/Menu.hs +++ b/src/Mtlstats/Types/Menu.hs @@ -28,6 +28,7 @@ module Mtlstats.Types.Menu ( -- * Lenses -- ** Menu Lenses menuTitle, + menuDefault, menuItems, -- ** MenuItem Lenses miKey, @@ -44,15 +45,22 @@ import Mtlstats.Types -- | Defines a menu data Menu a = Menu - { _menuTitle :: String - , _menuItems :: [MenuItem a] + { _menuTitle :: String + -- ^ The menu title + , _menuDefault :: a + -- ^ The default value + , _menuItems :: [MenuItem a] + -- ^ The list of items in the menu } -- | Defines a menu item data MenuItem a = MenuItem { _miKey :: Char + -- ^ The key that selects the menu item , _miDescription :: String + -- ^ The description of the menu item , _miAction :: StateT ProgState C.Curses a + -- ^ The action to be performed when selected } makeLenses ''Menu diff --git a/test/Types/MenuSpec.hs b/test/Types/MenuSpec.hs index f2e0778..5d9c826 100644 --- a/test/Types/MenuSpec.hs +++ b/test/Types/MenuSpec.hs @@ -36,7 +36,7 @@ menuSpec = describe "Menu" showSpec :: Spec showSpec = describe "show" $ it "should display correctly" $ let - menu = Menu "Foo" + menu = Menu "Foo" () [ MenuItem '1' "Item 1" $ return () , MenuItem '2' "Item 2" $ return () ]