user friendliness fixes

- use full sentences
- better menu flow
This commit is contained in:
Jonathan Lamothe
2018-12-28 12:59:48 -05:00
parent 9b5af711b3
commit e2c1453dcd
2 changed files with 60 additions and 51 deletions

View File

@@ -20,9 +20,17 @@ License along with this program. If not, see
-}
module Util (menu, run, withService, req, tryReq, confirm) where
module Util
( menu
, run
, withService
, setService
, req
, tryReq
, confirm
) where
import Control.Lens (view)
import Control.Lens (over, view)
import Control.Monad (join)
import Control.Monad.Trans.Class (lift)
import qualified Control.Monad.Trans.State as S
@@ -69,6 +77,9 @@ withService srv fb act = do
Nothing -> fb
Just x -> act x
setService :: String -> PWData -> S.StateT Status IO ()
setService k = S.modify . over database . pwSetService k
req :: Request a -> S.StateT s IO a
req = lift . fmap fromJust . runRequest . required