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