added password database to AppState
This commit is contained in:
@@ -33,6 +33,7 @@ module Password.App.Types (
|
||||
-- * Lenses
|
||||
-- ** AppState
|
||||
randGen,
|
||||
database,
|
||||
appMode,
|
||||
-- ** AppMode
|
||||
initState,
|
||||
@@ -51,11 +52,16 @@ import Lens.Micro (_1, _2)
|
||||
import Lens.Micro.TH (makeLenses)
|
||||
import System.Random (StdGen, initStdGen)
|
||||
|
||||
import Password
|
||||
|
||||
-- | The application state
|
||||
data AppState = AppState
|
||||
{ _randGen :: StdGen
|
||||
-- ^ The random number generator
|
||||
, _database :: PWDatabase
|
||||
-- ^ The password database
|
||||
, _appMode :: AppMode
|
||||
-- ^ The current operating mode
|
||||
}
|
||||
|
||||
-- | The applicaiton's mode
|
||||
@@ -88,6 +94,7 @@ concat <$> mapM makeLenses
|
||||
mkInitialState :: MonadIO m => m AppState
|
||||
mkInitialState = AppState
|
||||
<$> initStdGen
|
||||
<*> return newPWDatabase
|
||||
<*> return (InitMode newInitState)
|
||||
|
||||
-- | New `InitState` value
|
||||
|
||||
Reference in New Issue
Block a user