added haddock comments and default menu return value

This commit is contained in:
Jonathan Lamothe 2019-08-21 00:50:22 -04:00
parent 314b41b90b
commit 8f0bd22f90
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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 ()
]