aboutsummaryrefslogtreecommitdiffhomepage
path: root/Types
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-02-25 21:56:51 -0700
committerSean Whitton <spwhitton@spwhitton.name>2017-02-25 22:00:12 -0700
commit423247140f7248410bfd5d469f30ab15200aafe6 (patch)
tree5156ee75a0157a7b2f86655d07782bd2a7090e52 /Types
parentc05517582ea253a8a1b662269c4e2ede6d69f197 (diff)
downloadsscan-423247140f7248410bfd5d469f30ab15200aafe6.tar.gz
factor out ifScanSess
Diffstat (limited to 'Types')
-rw-r--r--Types/State.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Types/State.hs b/Types/State.hs
index c3f1ecf..befba24 100644
--- a/Types/State.hs
+++ b/Types/State.hs
@@ -2,7 +2,9 @@
module Types.State where
-import Lens.Micro.TH (makeLenses)
+import Data.Maybe
+import Lens.Micro ((^.))
+import Lens.Micro.TH (makeLenses)
-- | Whether to do colour, grey or b&w scans
data Colour = Lineart | Greyscale | Colour
@@ -48,3 +50,6 @@ data St =
-- other device-specific scanimage options we could support: --swdespeck; --color-filter; --depth
makeLenses ''St
+
+ifScanSess :: St -> a -> a -> a
+ifScanSess st a b = if isJust $ st^.stScanningSession then a else b