switched from lens package to microlens

This commit is contained in:
Jonathan Lamothe 2021-01-05 21:22:41 -05:00
parent c5cdde8f73
commit 807e09a5ae
11 changed files with 16 additions and 11 deletions

View File

@ -24,7 +24,8 @@ License along with this program. If not, see
module Types (Status (Status), gen, dbPath, masterPass, database) where module Types (Status (Status), gen, dbPath, masterPass, database) where
import Control.Lens (makeLenses, set, (^.)) import Lens.Micro (set, (^.))
import Lens.Micro.TH (makeLenses)
import System.Random (RandomGen (next, split), StdGen) import System.Random (RandomGen (next, split), StdGen)
import Password import Password

View File

@ -24,10 +24,11 @@ License along with this program. If not, see
module UI (getMasterPass, mainMenu) where module UI (getMasterPass, mainMenu) where
import Control.Lens (over, set, view, (^.))
import Control.Monad (when) import Control.Monad (when)
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
import qualified Control.Monad.Trans.State as S import qualified Control.Monad.Trans.State as S
import Lens.Micro (over, set, (^.))
import Lens.Micro.Extras (view)
import System.Console.HCL import System.Console.HCL
( Request ( Request
, prompt , prompt

View File

@ -33,12 +33,13 @@ module Util
, save , save
) where ) where
import Control.Lens (over, view)
import Control.Monad (join) import Control.Monad (join)
import Control.Monad.Trans.Class (lift) import Control.Monad.Trans.Class (lift)
import qualified Control.Monad.Trans.State as S import qualified Control.Monad.Trans.State as S
import Data.Aeson (decodeFileStrict, encodeFile) import Data.Aeson (decodeFileStrict, encodeFile)
import Data.Maybe (fromJust, fromMaybe) import Data.Maybe (fromJust, fromMaybe)
import Lens.Micro (over)
import Lens.Micro.Extras (view)
import System.Console.HCL import System.Console.HCL
( Request ( Request
, prompt , prompt

View File

@ -24,7 +24,8 @@ dependencies:
- aeson - aeson
- bytestring - bytestring
- containers - containers
- lens - microlens >= 0.4.11.2 && < 0.5
- microlens-th >= 0.4.3.6 && < 0.5
- random - random
ghc-options: ghc-options:

View File

@ -47,7 +47,6 @@ module Password (
pwHasService, pwSetService, pwGetService, pwRemoveService, pwSearch pwHasService, pwSetService, pwGetService, pwRemoveService, pwSearch
) where ) where
import Control.Lens (makeLenses, over, set, to, (^.))
import Data.Aeson import Data.Aeson
( FromJSON (parseJSON) ( FromJSON (parseJSON)
, ToJSON (toJSON) , ToJSON (toJSON)
@ -67,6 +66,8 @@ import Data.Digest.Pure.SHA
import qualified Data.Map as M import qualified Data.Map as M
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import qualified Data.Text as T import qualified Data.Text as T
import Lens.Micro (over, set, to, (^.))
import Lens.Micro.TH (makeLenses)
import System.Random (RandomGen, randoms, split) import System.Random (RandomGen, randoms, split)
-- | a mapping of service names to password data -- | a mapping of service names to password data

View File

@ -22,7 +22,7 @@ License along with this program. If not, see
module Spec.NewPWData (tests) where module Spec.NewPWData (tests) where
import Control.Lens ((^.)) import Lens.Micro ((^.))
import System.Random (mkStdGen, StdGen) import System.Random (mkStdGen, StdGen)
import Test.HUnit (Test (..), (~?=)) import Test.HUnit (Test (..), (~?=))

View File

@ -22,7 +22,7 @@ License along with this program. If not, see
module Spec.NewPWPolicy (tests) where module Spec.NewPWPolicy (tests) where
import Control.Lens ((^.)) import Lens.Micro ((^.))
import Test.HUnit (Test(..), (~?=)) import Test.HUnit (Test(..), (~?=))
import Password import Password

View File

@ -22,8 +22,8 @@ License along with this program. If not, see
module Spec.PWGenerate (tests) where module Spec.PWGenerate (tests) where
import Control.Lens (set, (^.))
import Data.Maybe (fromJust) import Data.Maybe (fromJust)
import Lens.Micro (set, (^.))
import System.Random (mkStdGen, StdGen) import System.Random (mkStdGen, StdGen)
import Test.HUnit import Test.HUnit
(Test (..) (Test (..)

View File

@ -22,8 +22,8 @@ License along with this program. If not, see
module Spec.ValidatePWData (tests) where module Spec.ValidatePWData (tests) where
import Control.Lens (set)
import qualified Data.ByteString.Lazy as B import qualified Data.ByteString.Lazy as B
import Lens.Micro (set)
import System.Random (mkStdGen, StdGen) import System.Random (mkStdGen, StdGen)
import Test.HUnit (Test (..), (~?=)) import Test.HUnit (Test (..), (~?=))

View File

@ -22,8 +22,8 @@ License along with this program. If not, see
module Spec.ValidatePWDatabase (tests) where module Spec.ValidatePWDatabase (tests) where
import Control.Lens (set)
import qualified Data.Map as M import qualified Data.Map as M
import Lens.Micro (set)
import System.Random (mkStdGen, StdGen) import System.Random (mkStdGen, StdGen)
import Test.HUnit (Test (..), (~?=)) import Test.HUnit (Test (..), (~?=))

View File

@ -22,7 +22,7 @@ License along with this program. If not, see
module Spec.ValidatePWPolicy (tests) where module Spec.ValidatePWPolicy (tests) where
import Control.Lens (set) import Lens.Micro (set)
import Test.HUnit (Test(..), (~?=)) import Test.HUnit (Test(..), (~?=))
import Password import Password