on master help sign in
Merge remote-tracking branch 'origin/refactor/microlens-migration'
08391a6Jonathan Daugherty
src/Graphics/Vty/Input.hs+1−1
@@ -137,7 +137,7 @@ import Graphics.Vty.Input.Loop
137import Graphics.Vty.Input.Terminfo
137import Graphics.Vty.Input.Terminfo
138
138
139import Control.Concurrent.STM
139import Control.Concurrent.STM
140−import Control.Lens
140+import Lens.Micro
141
141
142import qualified System.Console.Terminfo as Terminfo
142import qualified System.Console.Terminfo as Terminfo
143import System.Posix.Signals.Exts
143import System.Posix.Signals.Exts
src/Graphics/Vty/Input/Loop.hs+11−1
@@ -21,10 +21,14 @@ import Control.Applicative
21import Control.Concurrent
21import Control.Concurrent
22import Control.Concurrent.STM
22import Control.Concurrent.STM
23import Control.Exception (mask, try, SomeException)
23import Control.Exception (mask, try, SomeException)
24−import Control.Lens
24+import Data.Monoid
25+import Lens.Micro
26+import Lens.Micro.Mtl
27+import Lens.Micro.TH
25import Control.Monad (when, mzero, forM_)
28import Control.Monad (when, mzero, forM_)
26import Control.Monad.IO.Class (liftIO)
29import Control.Monad.IO.Class (liftIO)
27import Control.Monad.Trans.State (StateT(..), evalStateT)
30import Control.Monad.Trans.State (StateT(..), evalStateT)
31+import Control.Monad.State.Class (MonadState, modify)
28import Control.Monad.Trans.Reader (ReaderT(..))
32import Control.Monad.Trans.Reader (ReaderT(..))
29
33
30import Data.Char
34import Data.Char
@@ -212,3 +216,9 @@ foreign import ccall "vty_set_term_timing" setTermTiming :: Fd -> Int -> Int ->
212forkOSFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
216forkOSFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
213forkOSFinally action and_then =
217forkOSFinally action and_then =
214 mask $ \restore -> forkOS $ try (restore action) >>= and_then
218 mask $ \restore -> forkOS $ try (restore action) >>= and_then
219+
220+(<>=) :: (MonadState s m, Monoid a) => ASetter' s a -> a -> m ()
221+l <>= a = modify (l <>~ a)
222+
223+(<>~) :: Monoid a => ASetter s t a a -> a -> s -> t
224+l <>~ n = over l (`mappend` n)
src/Graphics/Vty/PictureToSpans.hs+9−1
@@ -21,7 +21,9 @@ import Graphics.Vty.Image.Internal
21import Graphics.Vty.Picture
21import Graphics.Vty.Picture
22import Graphics.Vty.Span
22import Graphics.Vty.Span
23
23
24−import Control.Lens hiding ( op )
24+import Lens.Micro
25+import Lens.Micro.Mtl
26+import Lens.Micro.TH
25import Control.Monad.Reader
27import Control.Monad.Reader
26import Control.Monad.State.Strict hiding ( state )
28import Control.Monad.State.Strict hiding ( state )
27
29
@@ -355,3 +357,9 @@ snocOp !op !row = do
355 when (spanOpsEffectedColumns ops' > regionWidth theRegion)
357 when (spanOpsEffectedColumns ops' > regionWidth theRegion)
356 $ fail $ "row " ++ show row ++ " now exceeds region width"
358 $ fail $ "row " ++ show row ++ " now exceeds region width"
357 MVector.write theMrowOps row ops'
359 MVector.write theMrowOps row ops'
360+
361+(-~) :: Num a => ASetter s t a a -> a -> s -> t
362+l -~ n = over l (subtract n)
363+
364+(+~) :: Num a => ASetter s t a a -> a -> s -> t
365+l +~ n = over l (n +)
test/VerifyUsingMockInput.hs+1−1
@@ -16,7 +16,7 @@ import Control.Applicative
16import Control.Concurrent
16import Control.Concurrent
17import Control.Concurrent.STM
17import Control.Concurrent.STM
18import Control.Exception
18import Control.Exception
19−import Control.Lens ((^.))
19+import Lens.Micro ((^.))
20import Control.Monad
20import Control.Monad
21
21
22import Data.Default
22import Data.Default
vty.cabal+9−4
@@ -57,7 +57,9 @@ library
57 deepseq >= 1.1 && < 1.5,
57 deepseq >= 1.1 && < 1.5,
58 directory,
58 directory,
59 filepath >= 1.0 && < 2.0,
59 filepath >= 1.0 && < 2.0,
60− lens >= 3.9.0.2 && < 5.0,
60+ microlens,
61+ microlens-mtl,
62+ microlens-th,
61 -- required for nice installation with yi
63 -- required for nice installation with yi
62 hashable >= 1.2,
64 hashable >= 1.2,
63 mtl >= 1.1.1.0 && < 2.3,
65 mtl >= 1.1.1.0 && < 2.3,
@@ -134,7 +136,8 @@ executable vty-demo
134 base >= 4 && < 5,
136 base >= 4 && < 5,
135 containers,
137 containers,
136 data-default >= 0.5.3,
138 data-default >= 0.5.3,
137− lens,
139+ microlens,
140+ microlens-mtl,
138 mtl >= 1.1.1.0 && < 2.3
141 mtl >= 1.1.1.0 && < 2.3
139
142
140test-suite verify-attribute-ops
143test-suite verify-attribute-ops
@@ -567,7 +570,8 @@ test-suite verify-using-mock-input
567 bytestring,
570 bytestring,
568 containers,
571 containers,
569 deepseq >= 1.1 && < 1.5,
572 deepseq >= 1.1 && < 1.5,
570− lens >= 3.9.0.2 && < 5.0,
573+ microlens,
574+ microlens-mtl,
571 mtl >= 1.1.1.0 && < 2.3,
575 mtl >= 1.1.1.0 && < 2.3,
572 stm,
576 stm,
573 terminfo >= 0.3 && < 0.5,
577 terminfo >= 0.3 && < 0.5,
@@ -603,7 +607,8 @@ test-suite verify-config
603 bytestring,
607 bytestring,
604 containers,
608 containers,
605 deepseq >= 1.1 && < 1.5,
609 deepseq >= 1.1 && < 1.5,
606− lens >= 3.9.0.2 && < 5.0,
610+ microlens,
611+ microlens-mtl,
607 mtl >= 1.1.1.0 && < 2.3,
612 mtl >= 1.1.1.0 && < 2.3,
608 string-qq,
613 string-qq,
609 terminfo >= 0.3 && < 0.5,
614 terminfo >= 0.3 && < 0.5,