From a3f405d9c50049b921ccf8db7af395a76bee9f66 Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Sat, 7 Sep 2024 15:40:10 -0400 Subject: [PATCH] make lenses for `AppState` --- src/Password/App/Types.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Password/App/Types.hs b/src/Password/App/Types.hs index 24bb549..e0a00b4 100644 --- a/src/Password/App/Types.hs +++ b/src/Password/App/Types.hs @@ -22,12 +22,16 @@ License along with this program. If not, see -} +{-# LANGUAGE TemplateHaskell #-} + module Password.App.Types ( AppState (..), + randGen, mkInitialState ) where import Control.Monad.IO.Class (MonadIO) +import Lens.Micro.TH import System.Random (StdGen, initStdGen) -- | The application state @@ -36,6 +40,8 @@ newtype AppState = AppState -- ^ The random number generator } deriving (Eq, Show) +makeLenses ''AppState + -- | Builds an initial state mkInitialState :: MonadIO m => m AppState mkInitialState = AppState <$> initStdGen